Issue #7310 has been updated by knu (Akinori MUSHA).

Status changed from Open to Rejected


Please read the RFCs, especially RFC 1738 and see how the path
part in FTP URI is defined.

tl;dr - URI('ftp://host/etc/motd').path == "etc/motd" and
        URI('ftp://host/%2Fetc/motd').path == "/etc/motd"

To retrieve a file at "ftp://host/cwd1/cwd2/file", an FTP client
logs in to the server "host", issues "CWD cwd1", "CWD cwd2" and
then "RETR file".  So, the path part of the URI should naturally
be taken as a relative path "cwd1/cwd2/file" not an absolute path
starting with a slash.  To say that you want a file
at "/cwd1/cwd2/file" on the host, the URI must be composed
as "ftp://host/%2Fcwd1/cwd2/file" in which the starting slash is
percent encoded as required by RFC 1738.

This is what existing programs expect and rely on.  We shouldn't
change that.  It's just that each scheme has its own set of
rules, which sometimes looks inconsistent.

----------------------------------------
Bug #7310: URI::FTP API inconsistency
https://bugs.ruby-lang.org/issues/7310#change-32628

Author: t3hk0d3 (Igor Yamolov)
Status: Rejected
Priority: Low
Assignee: 
Category: lib
Target version: next minor
ruby -v: 1.9.3p194


1.9.3p194 :012 > test = URI.parse("http://test/")
 => #<URI::HTTP:0x0000000142c100 URL:http://test/> 
1.9.3p194 :013 > test.path
 => "/" 
1.9.3p194 :014 > test = URI.parse("ftp://test/")
 => #<URI::FTP:0x00000001441488 URL:ftp://test/> 
1.9.3p194 :015 > test.path
 => "" 



-- 
http://bugs.ruby-lang.org/