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

View File

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