@sparkelf/dsh-patch-better-sidebar-media-path 0.2.1-alpha.24 → 0.2.1-alpha.26

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 <0.25.0"
13
+ "range": ">=0.25.0 <0.26.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.24"
36
+ "version": "0.2.1-alpha.26"
37
37
  }
@@ -1,16 +1,18 @@
1
1
  diff --git a/lib/index.js b/lib/index.js
2
+ index 7ce4ed1..1236d42 100644
2
3
  --- a/lib/index.js
3
4
  +++ b/lib/index.js
4
- @@ -4370,6 +4370,11 @@
5
+ @@ -7001,7 +7001,12 @@ function apply(ctx, config) {
5
6
  const sessionId = url.searchParams.get("sessionId");
6
7
  const raw = url.searchParams.get("path");
7
8
  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
+ - const path = await ensureWorkspacePath(await activeWorktreeRootOf(ctx, sessionId, await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0)), raw);
9
10
  + // The client sends the path it displays, which is workspace-relative when the file
10
11
  + // lies inside the session; cwd rides in the query for exactly this. An absolute path
11
12
  + // 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 mediaCwd = await activeWorktreeRootOf(ctx, sessionId, await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0));
13
14
  + const requested = isAbsolute(raw) ? raw : join(mediaCwd, raw);
14
15
  + const path = await ensureWorkspacePath(mediaCwd, requested);
15
16
  const info = await stat(path);
16
17
  if (!info.isFile() || info.size > resolved.mediaLimit) throw new SidebarError("fs-error", "not a file or too large", 400);
18
+ const type = mediaTypeForPath(path);