Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions lib/http_router/generator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def initialize(route, path, validation_regex = nil)
instance_eval <<-EOT, __FILE__, __LINE__ + 1
def generate(args, options)
generated_path = \"#{code}\"
#{validation_regex.inspect}.match(generated_path) ? URI.escape(generated_path) : nil
#{validation_regex.inspect}.match(generated_path) ? URI::DEFAULT_PARSER.escape(generated_path) : nil
end
EOT
else
instance_eval <<-EOT, __FILE__, __LINE__ + 1
def generate(args, options)
URI.escape(\"#{code}\")
URI::DEFAULT_PARSER.escape(\"#{code}\")
end
EOT
end
Expand Down Expand Up @@ -147,4 +147,4 @@ def append_querystring(uri, params)
uri
end
end
end
end
4 changes: 2 additions & 2 deletions lib/http_router/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Request

def initialize(path, rack_request)
@rack_request = rack_request
@path = URI.unescape(path).split(/\//)
@path = URI::DEFAULT_PARSER.unescape(path).split(/\//)
@path.shift if @path.first == ''
@path.push('') if path[-1] == ?/
@extra_env = {}
Expand All @@ -27,4 +27,4 @@ def path_finished?
@path.size == 0 or @path.size == 1 && @path.first == ''
end
end
end
end