[前][次][番号順一覧][スレッド一覧]

ruby-changes:56696

From: Nobuyoshi <ko1@a...>
Date: Mon, 29 Jul 2019 23:08:48 +0900 (JST)
Subject: [ruby-changes:56696] Nobuyoshi Nakada: 3ee63cfe88 (master): Match suffix for content type more precisely

https://git.ruby-lang.org/ruby.git/commit/?id=3ee63cfe88

From 3ee63cfe881c9ac52a52344ea83131b88875d14c Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Mon, 29 Jul 2019 22:54:58 +0900
Subject: Match suffix for content type more precisely

Suffix needs a dot and should match the end of string.

diff --git a/lib/rdoc/servlet.rb b/lib/rdoc/servlet.rb
index d6e8dc4..0ff83fd 100644
--- a/lib/rdoc/servlet.rb
+++ b/lib/rdoc/servlet.rb
@@ -102,9 +102,9 @@ class RDoc::Servlet < WEBrick::HTTPServlet::AbstractServlet https://github.com/ruby/ruby/blob/trunk/lib/rdoc/servlet.rb#L102
     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
 
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]