Rails ActiveStorage - S3 对象的内容类型为空
Rails ActiveStorage - Content-Type of S3 Object is empty
我使用 ActiveStorage 将对象上传到 AWS S3。
但是上传的 S3 对象的 Content-Type 是空的。
如何设置它们的内容类型?
以下是我做的。
@brand.compiled_css.attach(io: File.open(file_path), filename: "brand.css", content_type: "text/css")
我的Rails版本是5.2,Ruby版本是2.6.2。
这是意料之中的。 Rails 团队直到 6.0 才开始在上传的 S3 对象上设置内容类型。
https://github.com/rails/rails/issues/38817
我使用 ActiveStorage 将对象上传到 AWS S3。
但是上传的 S3 对象的 Content-Type 是空的。
如何设置它们的内容类型?
以下是我做的。
@brand.compiled_css.attach(io: File.open(file_path), filename: "brand.css", content_type: "text/css")
我的Rails版本是5.2,Ruby版本是2.6.2。
这是意料之中的。 Rails 团队直到 6.0 才开始在上传的 S3 对象上设置内容类型。 https://github.com/rails/rails/issues/38817