From 3ee63cfe881c9ac52a52344ea83131b88875d14c Mon Sep 17 00:00:00 2001 From: Nobuyoshi Nakada Date: Mon, 29 Jul 2019 22:54:58 +0900 Subject: [PATCH] Match suffix for content type more precisely Suffix needs a dot and should match the end of string. --- lib/rdoc/servlet.rb | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb index d6e8dc4672..0ff83fde77 100644 --- a/lib/rdoc/servlet.rb +++ b/lib/rdoc/servlet.rb @@ -102,9 +102,9 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet res.body = File.read asset_path res.content_type = case req.path - when /css$/ then 'text/css' - when /js$/ then 'application/javascript' - else 'application/octet-stream' + when /\.css\z/ then 'text/css' + when /\.js\z/ then 'application/javascript' + else 'application/octet-stream' end end