Reference uploads by server filename instead of absolute host path - #159
Open
craig-b wants to merge 1 commit into
Open
Reference uploads by server filename instead of absolute host path#159craig-b wants to merge 1 commit into
craig-b wants to merge 1 commit into
Conversation
/api/upload returned the saved file's absolute host path as 'path' (and extracted video/PDF page images as 'framePaths'), and the Web UI round- tripped those into /api/chat, /api/image-edit, and /api/video-generate. That leaked the server's filesystem layout (install location, user name, OS) to every client for no functional reason: the server can resolve its own upload directory. The upload response now carries 'file' — the server-assigned filename — and the existing 'frames' names; 'path' and 'framePaths' are gone. On the accept side a shared UploadFileReference resolver handles chat attachments (imagePaths/audioPaths/textFilePaths), image-edit imagePath(s), and the Wan i2v conditioning image: the canonical form is the bare filename, joined under the upload directory; absolute paths from older clients are still accepted when they resolve inside the upload directory (the same containment rule as PR zhongkaifu#146, which this builds on). ChatMessageParser.ValidateAttachmentPaths becomes ResolveAttachmentPaths — it now rewrites the lists to resolved full paths rather than only validating. The Web UI sends the returned filenames, and both API_EXAMPLES docs describe the new contract. Verified: /api/upload returns no absolute paths; resolver unit tests cover filename/absolute/traversal/sibling-prefix cases for chat and the Wan parser; inner-loop suite 1395 green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
/api/uploadreturns the saved file's absolute host path aspath(and extracted video/PDF page images asframePaths), and the Web UI round-trips those into/api/chat,/api/image-edit, and/api/video-generate. That leaks the server's filesystem layout (install location, user name, OS) to every client for no functional reason.The upload response now carries
file— the server-assigned filename — alongside the existingframesnames;pathandframePathsare gone. On the accept side, a sharedUploadFileReferenceresolver handles all three sites (chat attachments, image-editimagePath(s), Wan i2v conditioning image): the canonical form is the bare filename joined under the upload directory, and absolute paths from older clients are still accepted when they resolve inside the upload directory — the same containment rule as #146/#152, which this builds on.API contract change: clients reading
path/framePathsfrom the upload response must switch tofile/frames. The accept side stays backward-compatible. Both API_EXAMPLES documents are updated.Verified locally: new
UploadFileReferenceTests+ updated guard tests; environment-independent lane 1156 passed / 0 failed on current main.Touches some of the same server files as #160/#161 (opened alongside) — happy to rebase promptly as the others land.