Skip to content

fix: preserve original file extension on asset downloads (#41)#43

Merged
ravirajsinh45 merged 1 commit into
mainfrom
41-missing-file-extensions-on-download
Apr 11, 2026
Merged

fix: preserve original file extension on asset downloads (#41)#43
ravirajsinh45 merged 1 commit into
mainfrom
41-missing-file-extensions-on-download

Conversation

@ravirajsinh45

@ravirajsinh45 ravirajsinh45 commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Closes #41

Summary

  • Downloads were saving as Video_Title instead of Video_Title.mp4 because the API passed asset.name (no extension) as the Content-Disposition filename, and the dashboard further overrode it via a.download.
  • Backend: new build_download_filename() helper derives the extension from MediaFile.original_filename (authoritative) or the S3 key, and appends it to asset.name when missing (case-insensitive). Applied in /assets/{id}/stream and /share/{token}/stream/{asset_id}.
  • Frontend: the dashboard Download button now calls /stream?download=true and uses a hidden iframe instead of setting a.download. folder-share-viewer no longer overrides a.download so the browser honors the server's Content-Disposition filename.

Test plan

  • Download a video from the dashboard — file saves with .mp4 (or original) extension
  • Download an image / audio / carousel item from the dashboard — extension preserved
  • Download an asset from a public share link — extension preserved
  • "Download all" from a folder share link — each file saves with its extension
  • Assets whose name already includes the extension (e.g. clip.mp4) don't get it duplicated (clip.mp4.mp4)
  • HLS streaming (non-download) URLs are unchanged for video playback

🤖 Generated with Claude Code

Downloads were saving as "Video_Title" instead of "Video_Title.mp4"
because the API passed asset.name (human-readable, no extension) as the
Content-Disposition filename, and the dashboard overrode it further via
a.download.

Backend: new build_download_filename() helper derives the extension
from MediaFile.original_filename (authoritative) or the S3 key, and
appends it to asset.name when missing. Used by /assets/{id}/stream and
/share/{token}/stream/{asset_id}.

Frontend: the dashboard Download button now calls /stream?download=true
and uses a hidden iframe instead of setting a.download. folder-share-
viewer no longer overrides a.download so the browser honors the
server's Content-Disposition filename.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@ravirajsinh45 ravirajsinh45 linked an issue Apr 11, 2026 that may be closed by this pull request
@ravirajsinh45 ravirajsinh45 merged commit ed1bb08 into main Apr 11, 2026
4 checks passed
@ravirajsinh45 ravirajsinh45 deleted the 41-missing-file-extensions-on-download branch April 11, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Missing File Extensions on Download

1 participant