1
0
Fork 0
mirror of https://github.com/sinatra/sinatra synced 2023-03-27 23:18:01 -04:00

Drop Ruby 1.8 compat code

This commit is contained in:
Olle Jonsson 2019-04-12 22:29:34 +02:00 committed by GitHub
parent 5e2e41f283
commit 1115703b7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -19,18 +19,10 @@ module Rack
end end
def cleanup(path) def cleanup(path)
if path.respond_to?(:encoding)
# Ruby 1.9+ M17N
encoding = path.encoding encoding = path.encoding
dot = '.'.encode(encoding) dot = '.'.encode(encoding)
slash = '/'.encode(encoding) slash = '/'.encode(encoding)
backslash = '\\'.encode(encoding) backslash = '\\'.encode(encoding)
else
# Ruby 1.8
dot = '.'
slash = '/'
backslash = '\\'
end
parts = [] parts = []
unescaped = path.gsub(/%2e/i, dot).gsub(/%2f/i, slash).gsub(/%5c/i, backslash) unescaped = path.gsub(/%2e/i, dot).gsub(/%2f/i, slash).gsub(/%5c/i, backslash)