diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-14 01:11:28 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-14 01:11:28 +0000 |
commit | b53ec390d18e573a4c8192ab6615c881aed95574 (patch) | |
tree | 086880e77cbc13daa1b12cd83b4e55c6f30fc003 /lib/uri/generic.rb | |
parent | f5090e2f5ca5d5e0353659bdcba3c0a09e908178 (diff) | |
download | ruby-b53ec390d18e573a4c8192ab6615c881aed95574.tar.gz |
Allow empty path components in a URI [Bug #8352]
* generic.rb (URI::Generic#merge, URI::Generic#route_to): Fix a bug
where a sequence of slashes in the path part gets collapsed to a
single slash. According to the relevant RFCs and WHATWG URL
Standard, empty path components are simply valid and there is no
special treatment defined for them, so we just keep them as they
are.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61218 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/uri/generic.rb')
-rw-r--r-- | lib/uri/generic.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index dc4f9c4c30..629323e80e 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -979,7 +979,7 @@ module URI # returns an Array of the path split on '/' # def split_path(path) - path.split(%r{/+}, -1) + path.split(%r{/}, -1) end private :split_path @@ -1154,8 +1154,8 @@ module URI return dst.dup end - src_path = src.scan(%r{(?:\A|[^/]+)/}) - dst_path = dst.scan(%r{(?:\A|[^/]+)/?}) + src_path = src.scan(%r{[^/]*/}) + dst_path = dst.scan(%r{[^/]*/?}) # discard same parts while !dst_path.empty? && dst_path.first == src_path.first |