@sparkelf/dsh-patch-better-sidebar-html-preview-path 0.2.0-rc.4

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 DeepSeek
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/package.json ADDED
@@ -0,0 +1,37 @@
1
+ {
2
+ "description": "Data-only patch bounding a workspace-root-relative HTML preview path to the session cwd in dsh-better-sidebar",
3
+ "dshPatch": {
4
+ "formatVersion": 1,
5
+ "variants": [
6
+ {
7
+ "dsh": ">=0.1.6-alpha.1",
8
+ "file": "./patches/better-sidebar-html-preview-path.patch",
9
+ "id": "better-sidebar-html-preview-path",
10
+ "target": {
11
+ "kind": "npm",
12
+ "name": "dsh-better-sidebar",
13
+ "range": "0.19.1"
14
+ }
15
+ }
16
+ ]
17
+ },
18
+ "exports": {
19
+ "./package.json": "./package.json",
20
+ "./patches/better-sidebar-html-preview-path.patch": "./patches/better-sidebar-html-preview-path.patch"
21
+ },
22
+ "files": [
23
+ "patches/*.patch"
24
+ ],
25
+ "license": "MIT",
26
+ "name": "@sparkelf/dsh-patch-better-sidebar-html-preview-path",
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "repository": {
31
+ "directory": "patches/npm/better-sidebar-html-preview-path",
32
+ "type": "git",
33
+ "url": "git+https://github.com/SparkElf/deepseek-harness-plus.git"
34
+ },
35
+ "type": "module",
36
+ "version": "0.2.0-rc.4"
37
+ }
@@ -0,0 +1,21 @@
1
+ diff --git a/lib/index.js b/lib/index.js
2
+ index 278ca90..82d457d 100644
3
+ --- a/lib/index.js
4
+ +++ b/lib/index.js
5
+ @@ -5080,8 +5080,14 @@ function apply(ctx, config) {
6
+ writeError(res, new SidebarError("bad-request", decoded.message, decoded.status));
7
+ return;
8
+ }
9
+ - const { sessionId, path } = decoded.ref;
10
+ - const absolute = await ensureWorkspacePath(await sessionCwdOf(ctx, sessionId), path, fenceEnabledOf(() => settingsFace));
11
+ + const { sessionId, path: decodedPath } = decoded.ref;
12
+ + // A produced-file path arrives workspace-root-relative ("/x.html"): the host
13
+ + // reads it as a POSIX root and realpaths it outside the workspace. Bound it to
14
+ + // the session cwd first, the way the media route already bounds its own path.
15
+ + const htmlCwd = await sessionCwdOf(ctx, sessionId);
16
+ + const path = isAbsolute(decodedPath) && !isWithin(htmlCwd, decodedPath)
17
+ + ? join(htmlCwd, decodedPath) : decodedPath;
18
+ + const absolute = await ensureWorkspacePath(htmlCwd, path, fenceEnabledOf(() => settingsFace));
19
+ const info = await stat(absolute);
20
+ if (!info.isFile() || info.size > resolved.mediaLimit) throw new SidebarError("fs-error", "not a file or too large", 400);
21
+ const type = mediaTypeForPath(absolute);