Closed Bug 177964 Opened 22 years ago Closed 22 years ago

FTP: can't download file with # in its name

Categories

(Core Graveyard :: Networking: FTP, defect)

x86
Windows XP
defect
Not set
major

Tracking

(Not tracked)

VERIFIED FIXED
mozilla1.3alpha

People

(Reporter: jruderman, Assigned: neeti)

References

Details

(Keywords: regression, testcase)

Attachments

(3 files)

Steps to reproduce:
1. Log into Jeff's ftp with Phoenix 10/26 or with Mozilla.
2. Go to /upload/Hack_Sign/.
3. Look for episode 17 and click the link.

Result: "No such file or directory".

Filename:  /upload/Hack_Sign/[#Anime-Kraze]_Hack_17[SBC_HQ_DIVX].avi
Error: 550 /upload/Hack_Sign/[: No such file or directory.

The steps above work correctly in Internet Explorer and Netscape 4, but they
give an error message in Mozilla and Opera.  If I copy the URL, paste it into
the address bar, replace the # with %23, and press enter, I am able to download
the file with Mozilla.

Old, related bugs:
bug 27741 [fixed] can't visit directorys with ftp that include # or :
bug 77937 [fixed] '#''s in ftp url's dont work [as hashes pointing to anchors]

The bug seems to be in in the code that generates the HTML directory listing. 
It should convert # to %23 in the link URLs (like Netscape 4 does) so that when
I click to download a file with # in its name, the link works correctly.
Mozilla 1.2a - I've confirmed this.

The directory displays "#", but does not provide the correct link.

I thought we had covered the handling of "#", but I had forgotten to test for
the directory display's mapping of special characters to URLs for the filenames
themselves.
Yes, obviously the links are not escaped correctly (esc_FileBaseName-Mask)
before handed over to ftp.
 
me
Assignee: dougt → neeti
reporter: how do I log into Jeff's ftp?
similar: bug 180161
Attached patch proposed patchSplinter Review
Comment on attachment 108082 [details] [diff] [review]
proposed patch

the call to NS_EscapeURL leaks.
Attachment #108082 - Flags: review-
nhotta, could you look at this patch (ignoring the leak).  i believe this
problem to be regression caused by our fix for 165585.  Does this patch cause
the same problem that we had with 165585?
I think non ASCII characters would be all escaped. Is it possible to escape only
characters which really need to be escaped?
Also ToNewCString(unEscapeSpec) cannot be used for Unicode which may contain
characters greater than 255.

Attached patch revised patchSplinter Review
Attachment #108253 - Flags: superreview?(darin)
Attachment #108253 - Flags: review?(nhotta)
Comment on attachment 108253 [details] [diff] [review]
revised patch

+    NS_ConvertUCS2toUTF8 ucs2UnEscapeSpec(unEscapeSpec);

please change the variable name to something like utf8UnEscapeSpec because the
string is UTF-8.
Attachment #108253 - Flags: review?(nhotta) → review+
Attachment #108256 - Flags: review+
Comment on attachment 108253 [details] [diff] [review]
revised patch

>Index: nsIndexedToHTML.cpp

>+    NS_ConvertUCS2toUTF8 ucs2UnEscapeSpec(unEscapeSpec);

nit: ucs2UnEscapeSpec is not UCS2, but UTF8.  might be better
to use a name like utf8UnEscapeSpec.

sr=darin (no need to submit another patch)
Attachment #108253 - Flags: superreview?(darin) → superreview+
Comment on attachment 108256 [details] [diff] [review]
revised patch, changed variable name

sr=darin (whoops!! i hadn't noticed that you already fixed this)
Attachment #108256 - Flags: superreview+
Comment on attachment 108256 [details] [diff] [review]
revised patch, changed variable name

a=asa for checkin to 1.3a
Attachment #108256 - Flags: approval1.3a?
Attachment #108256 - Flags: approval1.3a? → approval1.3a+
cc to ylong for i18n verification once checked in
fix checked in.
Status: NEW → RESOLVED
Closed: 22 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.3alpha
> cc to ylong for i18n verification once checked in

verified download works with:
"#" + double byte characters
"#" + single byte and double byte characters
named file on an internal ftp site.
*** Bug 189708 has been marked as a duplicate of this bug. ***
+regression.

I was poking around w/ the duplicate, and noticed that this works in Netscape
7.0.1 (Mozilla 1.0.2), and Chimera 0.6 (branch?).

Is this something that regressed recently?
Keywords: regression
VERIFIED: Mozilla 1.3f, Win98
Keywords: testcase
Whiteboard: checkmac checklinux
VERIFIED: mozilla 1.4b, Linux+Mach-O
Status: RESOLVED → VERIFIED
Whiteboard: checkmac checklinux
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: