1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Match suffix for content type more precisely

Suffix needs a dot and should match the end of string.
This commit is contained in:
Nobuyoshi Nakada 2019-07-29 22:54:58 +09:00
parent bef398eb87
commit 3ee63cfe88
No known key found for this signature in database
GPG key ID: 4BC7D6DF58D8DF60

View file

@ -102,9 +102,9 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet
res.body = File.read asset_path res.body = File.read asset_path
res.content_type = case req.path res.content_type = case req.path
when /css$/ then 'text/css' when /\.css\z/ then 'text/css'
when /js$/ then 'application/javascript' when /\.js\z/ then 'application/javascript'
else 'application/octet-stream' else 'application/octet-stream'
end end
end end