fix: keep the original file name on API, MCP and agent uploads - #2024
Open
giladresisi wants to merge 1 commit into
Open
giladresisi wants to merge 1 commit into
giladresisi wants to merge 1 commit into
Conversation
Media.originalName was only set by the web-app upload, so media uploaded through the public API, the MCP uploadFromUrlTool or the chat agent showed no name in the Media tab and could not be found by name. Pass the incoming file name (multipart) or the URL's last path segment (URL uploads). Also truncate long names on the media tile and show the full name on hover.
Strix Security ReviewNo security issues found. Updated for Reviewed by Strix |
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
1 task
This branch has not been deployed
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.
What kind of change does this PR introduce?
Bug fix (backend public API, MCP tool, chat agent) plus a small frontend tweak (Media tab tile).
MediaService.saveFileaccepts anoriginalNameargument, but only the web-app upload passed it. Every other upload path (POST /public/v1/upload,POST /public/v1/upload-from-url, the MCPuploadFromUrlTool, and the chat agent's image upload inagent.graph.service.ts) now passes it too: the incomingfile.originalnamefor multipart, or the URL's last path segment (query string and hash stripped) for URL-based uploads. Storage naming, the schema, existing rows and the media list endpoints are unchanged.On the Media tab, the tile name now truncates with an ellipsis and shows the full name on hover instead of overflowing into neighbouring tiles.
Why was this change needed?
A customer who uploads all of their videos through the Postiz agent (MCP) reported that videos in the Media tab show no file name at all, so they cannot tell dozens of similar thumbnails apart, and asked for a way to map their original file names to Postiz media so the agent can find a video by name. The name was simply never stored for API-driven uploads. With this change it is stored the same way as for web-app uploads, so it renders in the Media tab and becomes searchable via the media list search by
originalName.Other information:
URL-derived names are not percent-decoded on purpose:
decodeURIComponentthrows on malformed escapes and in the public API path that would fail after the file was already uploaded to storage. Rows uploaded before this change keep a null name; no backfill.QA
curl -F "file=@./my-test-video.mp4" -H "Authorization: <key>" <backend>/public/v1/uploadand confirm the response and the newMediarow haveoriginalName=my-test-video.mp4.POST <backend>/public/v1/upload-from-urlwith{"url":"https://<host>/path/sample-clip.mp4"}; expectoriginalName=sample-clip.mp4..../sample-clip.mp4?token=abc#frag; expectsample-clip.mp4(query and hash dropped).uploadFromUrlToolwith the URL from step 2; expect the sameoriginalNameon the created row.Checklist:
🤖 Generated with Claude Code
https://claude.ai/code/session_0113mrwSKBb9jhocwHmgxpJJ