tauri-apps / tauri-apps/plugins-workspace

@tauri-apps/plugin-http throw Type error when Content-Disposition filename contains Chinese character.

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

Description

### Problem:
@tauri-apps/plugin-http throw Type error when Content-Disposition filename contains Chinese character, Chinese character encoding with UTF-8.
if filename is ASCII chars, it works ok.

### Version
"@tauri-apps/plugin-http": "^2.5.1",
tauri = { version = "2", features = [] }

### Demo URL:
curl -I https://www.domain.com/download?id=123

HTTP/1.1 200 Connection established

HTTP/1.1 200 OK
Content-Type: application/octet-stream
Connection: keep-alive
Access-Control-Allow-Origin: *
Cache-control: max-age=86400
Content-Transfer-Encoding: binary
Pragma: public
Content-Disposition: attachment; filename="中文-EN.pdf"

### Demo code:
```js
const { fetch } = await import('@tauri-apps/plugin-http');
let headResponse;
try {
headResponse = await fetch(url, { method: 'HEAD' });
} catch (error) {
console.warn('await fetch url error: ', error, url);
throw new Error('await fetch url error!');
}
```

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.