From 86ea3e2de4d170deac7052f3119611fd6730fb82 Mon Sep 17 00:00:00 2001 From: Ryunosuke Sato Date: Tue, 10 Sep 2024 22:41:44 +0900 Subject: [PATCH] Fix `Sprockets::Base#unescape` to avoid unexpected change landed in 3.7.4. 384bf452fdbf994a5b80c7cfc55009c98b7e6b76 breaks `Sprockets::Base#unescape`. The following code has been changed between 3.7.3 and 3.7.4. ``` console $ ruby -I ./lib -r sprockets -e 'p [Sprockets::VERSION, Sprockets::Environment.new.send(:unescape, "%")]' ``` ``` ["3.7.3", "%"] ["3.7.4", "%25"] ``` This commit changes back to the behavior of 3.7.3. --- lib/sprockets/legacy.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/sprockets/legacy.rb b/lib/sprockets/legacy.rb index c57f0bb71..c5f49ffa7 100644 --- a/lib/sprockets/legacy.rb +++ b/lib/sprockets/legacy.rb @@ -155,7 +155,7 @@ def matches_filter(filters, logical_path, filename) end def unescape(str) - URIUtils::URI_PARSER.unescape(str) + str = URIUtils::URI_PARSER.unescape(str) str.force_encoding(Encoding.default_internal) if Encoding.default_internal str end