Merge pull request #39861 from vinistock/faster_normalize_path
Switch regex for delete_suffix in normalize_path
This commit is contained in:
commit
9b029331b8
@ -19,11 +19,13 @@ def self.normalize_path(path)
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user