Project

General

Profile

Actions

Bug #3847

closed

URI.join does not join multiple paths

Bug #3847: URI.join does not join multiple paths

Added by kaiwren (Chonira Sidu Ponnappa) over 15 years ago. Updated almost 15 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
1.8.7, 1.9.2
Backport:
[ruby-core:32462]

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 15 years ago Actions #1

  • 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 15 years ago Actions #2

=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 15 years ago Actions #3

=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

Actions

Also available in: PDF Atom