fix: render audio object previews natively - #200
Merged
Conversation
Member
|
I noticed the two PRs you recently submitted. After reviewing the changes, I found that the modifications are very reasonable and well-designed. Thank you very much for your contribution to RustFS! We really appreciate your time and effort in helping us improve the project. |
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.
Pull Request
Description
Render object previews with normalized
audio/*Content-Types through the browser's native<audio controls>element.The previous generic fallback loaded audio inside
iframe sandbox="". That sandbox creates an opaque origin, so ranged media requests can be sent asOrigin: nulland rejected by the object endpoint's CORS policy. The dedicated audio mode keeps the generic iframe sandbox strict, avoids broadening RustFS CORS, and avoids fetching entire objects into blobs.Audio loading failures now render the existing localized
Preview unavailablealert. Existing text, image, PDF, Parquet, TIFF, unknown-type, and no-URL behavior remains unchanged.Type of Change
Testing
pnpm test:run: 390/390 passed.Origin: nullwithRange: bytes=0-and stayed at0:00 / 0:00; the native audio path reachedreadyState=4, played to 2 seconds by keyboard, and received206 Partial Contentwith no relevant browser errors.pnpm format:checkis currently blocked by an untouched upstream formatting issue incomponents/object/tiff-viewer.tsx; all files changed by this PR pass Prettier.Checklist
Related Issues
Fixes rustfs/rustfs#5788
Screenshots (if applicable)
The captures below use a deterministic local harness with a valid 8 kHz mono PCM WAV and
Content-Type: audio/wav. They demonstrate the preview DOM/media behavior without claiming a live RustFS deployment.Before — generic sandbox iframe
Legacy audio preview displayed disabled controls at
0:00 / 0:00; DOM inspection confirmediframe sandbox="", and the ranged media request carriedOrigin: null.After — native audio controls
The native audio preview loaded the 2-second WAV, remained keyboard-operable, and completed playback with a normal Range/206 response.
Additional Notes
sandbox=""; this PR does not addallow-same-origin.audio/*MIME types take priority over extension-based Parquet/TIFF detection.