2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 09:10:25 +08:00

Merge branch 'master' into search_posts_by_filetype

This commit is contained in:
Neil Lalonde 2017-07-25 14:41:20 -04:00 committed by GitHub
commit d8c27e3871
18042 changed files with 120300 additions and 33700 deletions

View file

@ -1,4 +1,5 @@
require "uri"
require "mini_mime"
require_dependency "file_store/base_store"
require_dependency "s3_helper"
require_dependency "file_helper"
@ -33,7 +34,7 @@ module FileStore
# stored uploaded are public by default
options = {
acl: "public-read",
content_type: opts[:content_type].presence || Rack::Mime.mime_type(File.extname(filename))
content_type: opts[:content_type].presence || MiniMime.lookup_by_filename(filename)&.content_type
}
# add a "content disposition" header for "attachments"
options[:content_disposition] = "attachment; filename=\"#{filename}\"" unless FileHelper.is_image?(filename)