# 在 Safari 中上传文件名复杂时遇到的问题

**URL:** <https://meta.discourse.org/t/issues-with-upload-files-with-complex-names-in-safari/123707>\
**Category:** Bug\
**Created:** [2019 年7 月 23 日 05:13 UTC](https://meta.discourse.org/t/issues-with-upload-files-with-complex-names-in-safari/123707 "2019-07-23T05:13:27Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

作者： ![gerhard](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/gerhard/32/119479_2.png) [@gerhard](https://meta.discourse.org/u/gerhard)\
发布日期： [2019 年7 月 28 日 12:51 UTC](https://meta.discourse.org/t/issues-with-upload-files-with-complex-names-in-safari/123707/5 "2019-07-28T12:51:22Z")

</div>

`send_file` 来自 Rails，目前未在 `Content-Disposition` 标头中使用 `filename*` 参数。这就是为什么这些文件名在大多数浏览器中会被损坏的原因。

Rails 6 将修复此问题：[Encode Content-Disposition filenames on send\_data and send\_file · rails/rails@890485c · GitHub](https://github.com/rails/rails/commit/890485cfce4c361c03a41ec23b0ba187007818cc)

我现在是否应该应用一个猴子补丁？而且 S3 存储似乎也应该设置 `filename*`。

> <https://github.com/discourse/discourse/blob/fe7f0982af9577314d87001f35b7ea15e044f8b7/lib/file_store/s3_store.rb#L115-L115>

---

_[View the full topic](https://meta.discourse.org/t/issues-with-upload-files-with-complex-names-in-safari/123707)._
