Commit 804b4edc by Jon Yurek

Be able to escale URL characters more easily

Including + now.
parent 17cae0e7
......@@ -58,7 +58,15 @@ module Paperclip
end
def escape_url(url)
(url.respond_to?(:escape) ? url.escape : URI.escape(url)).gsub(/(\/.+)\?(.+\.)/, '\1%3F\2').gsub(/\(/, '%28').gsub(/\)/, '%29').gsub(/\[/, '%5B').gsub(/\]/, '%5D')
if url.respond_to?(:escape)
url.escape
else
URI.escape(url).gsub(escape_regex){|m| "%#{m.ord.to_s(16).upcase}" }
end
end
def escape_regex
/[\?\(\)\[\]\+]/
end
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment