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

Switch regex for delete_suffix in normalize_path

This commit is contained in:
Vinicius Stock 2020-07-16 17:42:17 -04:00
parent bcfa51fba6
commit 4fb78a0b87
No known key found for this signature in database
GPG key ID: 2663369A79CCBEC9

View file

@ -19,11 +19,13 @@ module ActionDispatch
encoding = path.encoding
path = +"/#{path}"
path.squeeze!("/")
path.sub!(%r{/+\Z}, "")
path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
path = +"/" if path == ""
unless path == "/"
path.delete_suffix!("/")
path.gsub!(/(%[a-f0-9]{2})/) { $1.upcase }
end
path.force_encoding(encoding)
path
end
# URI path and fragment escaping