Commits

edogawaconan committed 646ad06

Better(?) escape.

Comments (0)

Files changed (1)

   format("%.3f %s", octets, HUMAN_SIZE_UNITS[ind])
 end
 
-# reference: https://gist.github.com/srinivasmohan/6143115
-# Except the ones it's adding isn't really correct.
-URI_UNSAFE = Regexp.union [URI::Parser.new.regexp[:UNSAFE], '[', ']']
+REL_PATH_UNSAFE = Regexp.new("[^#{URI::REGEXP::PATTERN::UNRESERVED}:@&=+$,;]").freeze
 def e(*arg)
-  URI.escape *arg, URI_UNSAFE
+  URI.escape *arg, REL_PATH_UNSAFE
 end