You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Attachment names that come in over ACP keep their URL encoding. If an image is sent with uri: "file:///tmp/photo%201.png", the part ends up with filename: "photo%201.png" instead of photo 1.png. Same for names with spaces, accented letters, # or %.
Embedded attachments get it twice. On replay the URI is rebuilt with pathToFileURL(filename) from the already encoded name, so photo%201.png turns into photo%25201.png in the URI.
You can also see it in the prompt wire test (packages/cli/test/acp/prompt.test.ts) by renaming its local image to local #1 100% café.png: the URI that reaches the server is fine, but the name is local%20%231%20100%25%20caf%C3%A9.png.
Expected: photo 1.png. One thing to keep in mind for a fix: Zed's ?path= query paths are already decoded, so those shouldn't be decoded again.
Thanks for the detailed report. I reproduced this on the latest dev (86ce19d). content.ts hasn't changed since v2.2.0, so that release behaves the same way.
The script below calls promptContentToParts with an image (file:///tmp/photo%201.png) and an embedded blob (file:///tmp/caf%C3%A9%20%231.bin). The parts end up with filename: "photo%201.png" and "caf%C3%A9%20%231.bin". Passing the data parts through partsToContentChunks then gives double-encoded replay URIs such as .../photo%25201.png.
The cause appears to be filenameFromUri, which takes the basename of url.pathname without decoding it. As you noted, the Zed ?path= branch is already decoded and should stay that way. Your PR #59793 addresses this.
Reproduction script (repro.ts)
// Run from an opencode checkout: bun /workspace/repro/repro.ts [/path/to/repo]constrepo=process.argv[2]??"/workspace/repo"const{ promptContentToParts, partsToContentChunks }=awaitimport(`${repo}/packages/cli/src/acp/content.ts`)constparts=promptContentToParts([{type: "image",data: "",mimeType: "image/png",uri: "file:///tmp/photo%201.png"},{type: "image",data: "AAAA",mimeType: "image/png",uri: "file:///tmp/photo%201.png"},{type: "resource",resource: {uri: "file:///tmp/caf%C3%A9%20%231.bin",mimeType: "application/octet-stream",blob: "AAAA"}},])for(constpofparts)console.log("part filename:",JSON.stringify(p.filename),"url:",p.url.slice(0,40))constreplay=partsToContentChunks(parts.filter((p: any)=>p.url.startsWith("data:")))for(constcofreplay)console.log("replay uri:",(c.contentasany).uri??(c.contentasany).resource?.uri)
I reproduced this on dev (958f965). file:///tmp/photo%201.png yields filename: photo%201.png, and replay double-encodes embedded names (caf%25C3%25A9...). I'd like to take it.
Plan: decode file: basenames with fileURLToPath, decode HTTP(S) path segments safely, and add regression tests for spaces, #, %, and Unicode. No open PR found.
Activity
opencodejr commentedon Oct 28, 2026
Thanks for the detailed report. I reproduced this on the latest
dev(86ce19d).content.tshasn't changed since v2.2.0, so that release behaves the same way.The script below calls
promptContentToPartswith an image (file:///tmp/photo%201.png) and an embedded blob (file:///tmp/caf%C3%A9%20%231.bin). The parts end up withfilename: "photo%201.png"and"caf%C3%A9%20%231.bin". Passing the data parts throughpartsToContentChunksthen gives double-encoded replay URIs such as.../photo%25201.png.The cause appears to be
filenameFromUri, which takes the basename ofurl.pathnamewithout decoding it. As you noted, the Zed?path=branch is already decoded and should stay that way. Your PR #59793 addresses this.Reproduction script (repro.ts)
Run it:
bun repro.tsVaili commentedon Oct 30, 2026
I reproduced this on
dev(958f965).file:///tmp/photo%201.pngyieldsfilename: photo%201.png, and replay double-encodes embedded names (caf%25C3%25A9...). I'd like to take it.Plan: decode
file:basenames withfileURLToPath, decode HTTP(S) path segments safely, and add regression tests for spaces,#,%, and Unicode. No open PR found.