tauri-apps / tauri-apps/plugins-workspace

[bug] wrong content-type returned via tiny-http (Rust)

Open
#880 6 comments 0 reactions 0 assignees View on GitHub
plugin: localhost type: bug
Dominant language
Rust
Stars
1.8k
Forks
602
Avg merge
4d 14h
Merged PRs (30d)
9

Description

### Describe the bug

Hi, I tried to use tauri to package some static files (webvm), and I found one resource `/debian_mini_20240103_7393161196.ext2` request returned `Content-Type: text/html` and `Transfer-Encoding: chunked`.

The mime type of unknown file maybe represent as binary file (`Content-Type: application/octet-stream`).

### Reproduction

_No response_

### Expected behavior

I expected the server returned `Content-Type: application/octet-stream` and `Content-Range: bytes 0-1/629145600` for `/debian_mini_20240103_7393161196.ext2`.

### Full `tauri info` output

```text
[✔] Environment
- OS: Windows 10.0.22631 X64
✔ WebView2: 120.0.2210.91
✔ MSVC: Visual Studio Community 2022
✔ rustc: 1.75.0 (82e1608df 2023-12-21)
✔ cargo: 1.75.0 (1d8b05cdd 2023-11-20)
✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
- node: 18.18.2
- pnpm: 8.9.0
- yarn: 1.22.17
- npm: 10.2.4

[-] Packages
- tauri [RUST]: 1.5.3
- tauri-build [RUST]: 1.5.0
- wry [RUST]: 0.24.6
- tao [RUST]: 0.16.5
- tauri-cli [RUST]: 1.3.1
- @tauri-apps/api : not installed!
- @tauri-apps/cli [NPM]: 1.5.7

[-] App
- build-type: bundle
- CSP: unset
- distDir: ../../../../Downloads/msi/webvm
- devPath: ../src
```

### Stack trace

_No response_

### Additional context

How can I configure/overwrite the mime type of a specified resource? And is there any way to make the response return `Content-Length` and `Content-Range` instead of `Transfer-Encoding: chunked`.

I also posted a discussion on https://github.com/tauri-apps/tauri/discussions/8533.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.