Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix font related file mime type nil problem #322

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/asset_sync/multi_mime.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ def self.lookup(ext)
ext_with_dot = ".#{ext}"
Rack::Mime.mime_type(ext_with_dot)
else
::MIME::Types.type_for(ext).first
end
nil
end || ::MIME::Types.type_for(ext).first

end

Expand Down
11 changes: 3 additions & 8 deletions lib/asset_sync/storage.rb
Original file line number Diff line number Diff line change
Expand Up @@ -134,16 +134,11 @@ def upload_file(f)
:key => f,
:body => File.open("#{path}/#{f}"),
:public => true,
:content_type => mime
:content_type => mime,
:cache_control => "public, max-age=#{one_year}",
:expires => CGI.rfc1123_date(Time.now + one_year)
}

if /-[0-9a-fA-F]{32}$/.match(File.basename(f,File.extname(f)))
file.merge!({
:cache_control => "public, max-age=#{one_year}",
:expires => CGI.rfc1123_date(Time.now + one_year)
})
end

# overwrite headers if applicable, you probably shouldn't specific key/body, but cache-control headers etc.

if files_with_custom_headers.has_key? f
Expand Down