@sparkelf/dsh-patch-better-sidebar-media-path 0.1.0-rc.33
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 +21 -0
- package/README.i18n.yaml +6 -0
- package/README.md +11 -0
- package/README.zh.md +11 -0
- package/package.json +37 -0
- package/patches/better-sidebar-media-path.patch +16 -0
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/README.i18n.yaml
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
# Bilingual-pair consistency record (docs/i18n/README.md): the git blob hash of each
|
|
2
|
+
# side as of the last confirmed-consistent state. Both languages carry equal authority;
|
|
3
|
+
# after editing either side, bring the other along and re-record with:
|
|
4
|
+
# pnpm run verify-translation-pairing --write patches/npm/better-sidebar-media-path/README.md
|
|
5
|
+
README.md: e54e586ea58019638e5b0324d803c94c4a77ca51
|
|
6
|
+
README.zh.md: 1ad5fd86dded85891015bae979e4560d6a2dc787
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @sparkelf/dsh-patch-better-sidebar-media-path
|
|
2
|
+
|
|
3
|
+
English | [中文](README.zh.md)
|
|
4
|
+
|
|
5
|
+
This data-only package patches `dsh-better-sidebar@0.19.1`. Its `/sidebar/file` route passed the query's `path` straight to `ensureWorkspacePath`, which requires an absolute path, while the client sends the path it displays — workspace-relative when the file lies inside the session — and rides `cwd` in the query for exactly that purpose. Every image linked from a conversation inside a workspace answered `400 "is not an absolute path"`, and the same file served fine when the caller sent an absolute form.
|
|
6
|
+
|
|
7
|
+
The payload changes only `lib/index.js`, joining a relative path onto the resolved session cwd as `resolveGitPath` already does. Remove it when `dsh-better-sidebar` publishes the same behavior; the upstream fix is [omdsh-dev/DSH-better-sidebar#673](https://github.com/omdsh-dev/DSH-better-sidebar/pull/673).
|
|
8
|
+
|
|
9
|
+
## Model Experience
|
|
10
|
+
|
|
11
|
+
None. The patch changes how the browser resolves a file link it already receives; no model-visible input, tool result, or prompt changes.
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @sparkelf/dsh-patch-better-sidebar-media-path
|
|
2
|
+
|
|
3
|
+
[English](README.md) | 中文
|
|
4
|
+
|
|
5
|
+
这个纯数据包修补 `dsh-better-sidebar@0.19.1`。它的 `/sidebar/file` 路由把查询里的 `path` 直接交给 `ensureWorkspacePath`,而后者要求绝对路径;客户端发送的却是它显示的那条路径——文件位于会话内时是工作区相对路径——并且在查询里带上 `cwd`,正是为了让宿主解析它。于是工作区内从对话链接的每张图片都返回 `400 "is not an absolute path"`,而同一个文件在调用方发送绝对路径时却能正常提供。
|
|
6
|
+
|
|
7
|
+
payload 只修改 `lib/index.js`,把相对路径接到解析后的会话 cwd 上,与 `resolveGitPath` 已有的做法一致。当 `dsh-better-sidebar` 发布相同行为后即可移除;上游修复见 [omdsh-dev/DSH-better-sidebar#673](https://github.com/omdsh-dev/DSH-better-sidebar/pull/673)。
|
|
8
|
+
|
|
9
|
+
## Model Experience
|
|
10
|
+
|
|
11
|
+
无。该补丁改变的是浏览器如何解析它已经收到的文件链接;不涉及任何模型可见输入、工具结果或提示词。
|
package/package.json
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"description": "Data-only patch resolving a workspace-relative media path against the session cwd in dsh-better-sidebar",
|
|
3
|
+
"dshPatch": {
|
|
4
|
+
"formatVersion": 1,
|
|
5
|
+
"variants": [
|
|
6
|
+
{
|
|
7
|
+
"dsh": ">=0.1.5-rc.2",
|
|
8
|
+
"file": "./patches/better-sidebar-media-path.patch",
|
|
9
|
+
"id": "better-sidebar-media-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-media-path.patch": "./patches/better-sidebar-media-path.patch"
|
|
21
|
+
},
|
|
22
|
+
"files": [
|
|
23
|
+
"patches/*.patch"
|
|
24
|
+
],
|
|
25
|
+
"license": "MIT",
|
|
26
|
+
"name": "@sparkelf/dsh-patch-better-sidebar-media-path",
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"repository": {
|
|
31
|
+
"directory": "patches/npm/better-sidebar-media-path",
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/SparkElf/deepseek-harness-plus.git"
|
|
34
|
+
},
|
|
35
|
+
"type": "module",
|
|
36
|
+
"version": "0.1.0-rc.33"
|
|
37
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
diff --git a/lib/index.js b/lib/index.js
|
|
2
|
+
index 74c7171..278ca90 100644
|
|
3
|
+
--- a/lib/index.js
|
|
4
|
+
+++ b/lib/index.js
|
|
5
|
+
@@ -5040,7 +5040,10 @@ function apply(ctx, config) {
|
|
6
|
+
const sessionId = url.searchParams.get("sessionId");
|
|
7
|
+
const raw = url.searchParams.get("path");
|
|
8
|
+
if (sessionId === null || raw === null) throw new SidebarError("bad-request", "sessionId and path are required");
|
|
9
|
+
- const path = await ensureWorkspacePath(await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0), raw, fenceEnabledOf(() => settingsFace));
|
|
10
|
+
+ // The client sends the path it displays, which is workspace-relative when the
|
|
11
|
+
+ // file lies inside the session; cwd rides in the query for exactly this.
|
|
12
|
+
+ const requested = isAbsolute(raw) ? raw : join(await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0), raw);
|
|
13
|
+
+ const path = await ensureWorkspacePath(await sessionCwdOf(ctx, sessionId, url.searchParams.get("cwd") ?? void 0), requested, fenceEnabledOf(() => settingsFace));
|
|
14
|
+
const info = await stat(path);
|
|
15
|
+
if (!info.isFile() || info.size > resolved.mediaLimit) throw new SidebarError("fs-error", "not a file or too large", 400);
|
|
16
|
+
const type = mediaTypeForPath(path);
|