Closed Bug 206319 Opened 21 years ago Closed 21 years ago

"Save Page As... Web Page, complete" saves files outside the _files directory

Categories

(Core Graveyard :: File Handling, defect)

x86
Windows ME
defect
Not set
minor

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: dc2, Assigned: adamlock)

References

()

Details

Attachments

(1 file)

User-Agent:       Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.4b) Gecko/20030507
Build Identifier: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:1.4b) Gecko/20030507

Two .gif files that the .html file references are saved in the same directory as
the .html file, not inside the _files folder.

Reproducible: Always

Steps to Reproduce:
1. Go to http://www.netmechanic.com/news/
2. File > Save Page As...
3. Choose "Web Page, complete"
4. Click the desktop icon on the left (or put in the Windows Desktop directory)
5. Click Save
Actual Results:  
Files/directories generated are...

"JavaScript tricks and more - Webmaster Tips Newsletter.html"
"JavaScript tricks and more - Webmaster Tips Newsletter_files" folder & contents
inside.
"_001.gif"
"_002.gif"

Expected Results:  
"_001.gif" and "_002.gif" should be in the _files folder.

The two files are adverts. If you load the page then you can see the two broken
image.

If you move the two .gif files into the _files directory and reload, the images
are okay.

My system is Windows ME but the option is not available.
Okay, Windows ME isn't available on the submit bug page but it is here, so I've
changed it...
OS: Windows 98 → Windows ME
Verified 20030516 PC/WinXP
->Networking/File
Status: UNCONFIRMED → NEW
Ever confirmed: true
->Networking/File
Assignee: general → darin
Component: Browser-General → Networking: File
QA Contact: general → benc
I also see this on LInux 2003051908
-> File Handling
Assignee: darin → law
Component: Networking: File → File Handling
QA Contact: benc → petersen
.
Assignee: law → adamlock
The URLs in question that trigger this behaviour are like this:

http://ads.netmechanic.com/?AI=439&SN=4&FN=TruckSign.gif&RANDOM=2003.05.21.19.09.45
http://ads.netmechanic.com/?AI=595&SN=9&FN=Overture125.gif&RANDOM=2003.05.21.19.09.49

The persist object appears to be creating _001.gif & _002.gif files because it
can't produce a reasonable name from the URL. The wacky URL is also screwing up
how the name is appended to the local data path with the result it ends up going
outside the dir.

I would guess that MakeFilenameFromURI should always ensure that there is at
least one character in the filename rather than ignore it (see "Filename could
be empty at this point" comment).

A patch follows
Attached patch PatchSplinter Review
Patch changes MakeFilenameFromURI to always have at least one char in the
filename.
Comment on attachment 123935 [details] [diff] [review]
Patch

Requesting an r/sr on this simple fix. Ensuring filenames have at least one
character stops the nsILocalFile impl from getting confused later on.
Attachment #123935 - Flags: superreview?(jaggernaut)
Attachment #123935 - Flags: review?(brade)
Comment on attachment 123935 [details] [diff] [review]
Patch

r=brade
Attachment #123935 - Flags: review?(brade) → review+
Comment on attachment 123935 [details] [diff] [review]
Patch

Talked to Adam, sr=jag if a slightly more verbose comment is added for why
filename can't be empty.
Attachment #123935 - Flags: superreview?(jaggernaut) → superreview+
Comment on attachment 123935 [details] [diff] [review]
Patch

Requesting 1.4 approval for this small and obvious fix. It prevents strange
urls from dumping files outside of the data dir during persistence.
Attachment #123935 - Flags: approval1.4?
Fix is checked in with a more meaningful comment.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Verified in the 2003-06-09-08 win32 trunk build.
Status: RESOLVED → VERIFIED
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: