cloudreve / Cloudreve

🌩支持多家云存储的云盘系统 (Self-hosted file management and sharing system, supports multiple storage providers)
https://cloudreve.org
GNU General Public License v3.0
22.01k stars 3.45k forks source link

Filename not URL decoded when using Safari #1576

Closed baobao1270 closed 10 months ago

baobao1270 commented 1 year ago

Describe the bug When downloading a file from Tencent COS (private write/read bucket) on Safari, the filename is url-encoded like %E4%BE%8B%E5%AD%90.zip, instead of 例子.zip. Firefox on macOS, Firefox on Windows and Chrome on Windows does not have the bug.

To Reproduce Steps to reproduce the behavior:

  1. Configure the Cloudreve with a Tencent COS (private write/read bucket) storage
  2. Upload a file with Chinese character in its name
  3. Download it on Safari
  4. See error

Expected behavior The Cloudreve handle the filename correctly

Desktop (please complete the following information):

Additional context Cloudreve passes the response-content-disposition URL param to COS. The param is url-encoded, COS will decode it and response it as Content-Disposition header. However, different browser has different behavior on this header. That is the cause of bug.

On Chrome/Firefox, Cloudreve's behavior is correct. They accepts the Content-Disposition header like Content-Disposition: attachment; filename="%E4%BE%8B%E5%AD%90.zip".

However, on Safari, it works different. It only accepts the header like Content-Disposition: attachment; filename="例子.zip"

I think Cloudreve should determine the browser based on user agent, and pass response-content-disposition for different browsers.

The Internet Explorer's behavior is more weird. I don't want to research on IE for it is too old and even Microsoft is abandoning it.

stale[bot] commented 11 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.