Bug #3847
closedURI.join does not join multiple paths
Description
=begin
URI.join('http://foo.com', '/bar', '/baz') produces http://foo.com/baz while the documentation implies that it should produce http://foo.com/bar/baz
Tested this on 1.8.7 and 1.9.2 and they both produce the same results.
Either the documentation should be updated to explicitly state that URI.join with drop any existing path on the url, or the implementation needs to be changed to allow appending multiple paths to the url.
=end
Updated by naruse (Yui NARUSE) over 14 years ago
- Status changed from Open to Closed
- % Done changed from 0 to 100
=begin
This issue was solved with changeset r29322.
Chonira, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.
=end
Updated by bramswenson (Bram Swenson) over 14 years ago
=begin
It seems that the expected behavior of a join method like this would be to concatenate any number of strings into a full url. Basically this should operate in near identical fashion as Array#join with url escaping and protocol validation. Indeed, the documents for this method seem to imply just that. In fact, one should not have to inject '/' characters into URI join at all. This doesn't seem like its fixed to me, and I am sure quite a few folks would agree.
=end
Updated by naruse (Yui NARUSE) over 14 years ago
=begin
Hmm, so you say add more exmaple like following?
p URI.join('http://example.com', '/foo', 'bar', '../baz')¶
# => #<URI::HTTP:0x801a92af0 URL:http://example.com/foo/baz> ¶
=end