-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[bug] audio tag using a asset resource file as the source, the asset server returns wrong content-type of text/html #5203
Comments
This only affects requests with This is probably because in the initial request we are reading the first bytes of the file where it usually contains the magic number to identify the file while subsequent requests might not have the magic number inside it and so @lucasfernog should we use https://docs.rs/infer/0.9.0/infer/fn.get_from_path.html instead? |
We shouldn't infer the mime type from the path, that's a security vulnerability. We could instead cache the mime type on range requests or maybe always read the first bytes. |
|
although I think caching might be better for performance? |
Describe the bug
audio tag using a asset resource file as the source, the asset server returns wrong content-type of text/html
Reproduction
create project with audio files in bundle.resources create a filepath using something like
use in audio tag
<audio controls><source src="{filePath}" type="audio/mpeg" /></audio>
Expected behavior
the content type to be audio/mpeg
Platform and versions
Environment
› OS: Mac OS 12.2.1 X64
› Node.js: 16.15.0
› npm: 8.8.0
› pnpm: 7.0.0
› yarn: Not installed!
› rustup: 1.25.1
› rustc: 1.63.0
› cargo: 1.63.0
› Rust toolchain: stable-aarch64-apple-darwin
Packages
› @tauri-apps/cli [NPM]: 1.1.0
› @tauri-apps/api [NPM]: 1.1.0
› tauri [RUST]: 1.1.0,
› tauri-build [RUST]: 1.1.0,
› tao [RUST]: 0.14.0,
› wry [RUST]: 0.21.0,
App
› build-type: bundle
› CSP: default-src 'self'; img-src 'self' asset: https://asset.localhost; media-src 'self' asset: https://asset.localhost;
› distDir: ../dist
› devPath: http://localhost:3000/
› framework: Svelte
App directory structure
├─ node_modules
├─ public
├─ src-tauri
├─ .git
├─ .vscode
└─ src
Stack trace
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: