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
1 changed files with 6 additions and 4 deletions

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