@sparkelf/dsh-patch-better-sidebar-media-path 0.2.1-alpha.14 → 0.2.1-alpha.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"target": {
|
|
11
11
|
"kind": "npm",
|
|
12
12
|
"name": "dsh-better-sidebar",
|
|
13
|
-
"range": "0.21.1"
|
|
13
|
+
"range": ">=0.21.1 <0.25.0"
|
|
14
14
|
}
|
|
15
15
|
}
|
|
16
16
|
]
|
|
@@ -33,5 +33,5 @@
|
|
|
33
33
|
"url": "git+https://github.com/SparkElf/deepseek-harness-plus.git"
|
|
34
34
|
},
|
|
35
35
|
"type": "module",
|
|
36
|
-
"version": "0.2.1-alpha.
|
|
36
|
+
"version": "0.2.1-alpha.17"
|
|
37
37
|
}
|
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
diff --git a/lib/index.js b/lib/index.js
|
|
2
2
|
--- a/lib/index.js
|
|
3
3
|
+++ b/lib/index.js
|
|
4
|
-
@@ -
|
|
4
|
+
@@ -4370,6 +4370,11 @@
|
|
5
5
|
const sessionId = url.searchParams.get("sessionId");
|
|
6
6
|
const raw = url.searchParams.get("path");
|
|
7
7
|
if (sessionId === null || raw === null) throw new SidebarError("bad-request", "sessionId and path are required");
|
|
8
|
-
- const path = await ensureWorkspacePath(await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0), raw
|
|
9
|
-
+ // The client sends the path it displays, which is workspace-relative when the
|
|
10
|
-
+ //
|
|
11
|
-
+
|
|
12
|
-
+ const
|
|
8
|
+
- const path = await ensureWorkspacePath(await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0), raw);
|
|
9
|
+
+ // The client sends the path it displays, which is workspace-relative when the file
|
|
10
|
+
+ // lies inside the session; cwd rides in the query for exactly this. An absolute path
|
|
11
|
+
+ // that already names a real file is used as sent.
|
|
12
|
+
+ const mediaCwd = await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0);
|
|
13
|
+
+ const requested = isAbsolute(raw) ? raw : join(mediaCwd, raw);
|
|
14
|
+
+ const path = await ensureWorkspacePath(mediaCwd, requested);
|
|
13
15
|
const info = await stat(path);
|
|
14
16
|
if (!info.isFile() || info.size > resolved.mediaLimit) throw new SidebarError("fs-error", "not a file or too large", 400);
|
|
15
|
-
const type = mediaTypeForPath(path);
|