Closed
Bug 180161
Opened 22 years ago
Closed 21 years ago
Filenames with # won't save correctly - file name gets truncated
Categories
(Core Graveyard :: File Handling, defect, P4)
Core Graveyard
File Handling
Tracking
(Not tracked)
RESOLVED
INVALID
mozilla1.6beta
People
(Reporter: bjorn.wiberg, Assigned: bzbarsky)
References
()
Details
(Keywords: helpwanted)
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20021105 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.2b) Gecko/20021105 Saving a file (e.g. a picture) with a # in its name, e.g. "jn27#003.jpg", will make Mozilla save it as "jn27" (the last part gets cut off and the file extension is lost). Reproducible: Always Steps to Reproduce: 1. Load a page with a picture with a filename containing # 2. Choose "Save Image As..." 3. Notice the incorrect filename displayed in the dialog. Actual Results: File gets saved with only the part before #, and with no file extension. Expected Results: Save the file as "jn27#003.jpg" instead of "jn27".
similar: bug 177964
Reporter | ||
Comment 3•22 years ago
|
||
I wouldn't say that it's similar to bug 17794 -- that bug caused problems accessing a file; here, the image or file is correctly accessed but gets an incorrect name during save.
Reporter | ||
Comment 4•22 years ago
|
||
(Sorry, a small typo -- I meant bug 177964.)
Assignee | ||
Comment 5•22 years ago
|
||
yay, go ben... Taking. I'll fix this as I rewrite all this crud, but if someone wants to do it in the meantime, the problem is the use of a URI to get the extension in contentAreaUtils.js
Assignee: law → bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
Keywords: helpwanted
OS: Windows XP → All
Priority: -- → P4
Hardware: PC → All
Target Milestone: --- → mozilla1.4beta
Comment 6•22 years ago
|
||
This seems to work just fine for me on a current trunk build. (linux) Is this still a problem for anybody?
Assignee | ||
Comment 7•22 years ago
|
||
I still see this problem.... How exactly did you manage to avoid it?
Comment 8•22 years ago
|
||
dunno, I did this: echo foobar > /tmp/foo#bar Then I loaded that page in Mozilla (highlighted the text in gnome-terminal, hit middle mouse button in mozilla's content area) Then: File->Save Page As that worked. After that worked, I copied an image to /tmp/foo#bar, hit reload in my browser window. image appeared. Then I right-clicked on the image and chose Save Image As. The filename was displayed as foo#bar in the save dialog, and saving worked.
Assignee | ||
Comment 9•22 years ago
|
||
'#' gets escaped differently in file:// and http:// urls, perhaps? If you try the URL in the URL field (save image as on the image there) this is quite broken.
Comment 10•22 years ago
|
||
ah, I see. that still fails for me, true.
Assignee | ||
Updated•21 years ago
|
Target Milestone: mozilla1.4beta → mozilla1.6beta
Comment 11•21 years ago
|
||
"the problem is the use of a URI to get the extension in contentAreaUtils.js" bz, can you explain a bit? I looked at the code and wasn't sure where to fix this. Is the fix a js fix or does something need to change at a lower level? I could look into fixing this.
Assignee | ||
Comment 12•21 years ago
|
||
Pratik, the code in question is in getDefaultExtension(). In particular, see http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#840
Assignee | ||
Comment 13•21 years ago
|
||
Oops, sorry. I meant getNormalizedLeafName(), actually. This is called at http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#302 and the problematic code is at http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#817
Comment 14•21 years ago
|
||
bz, I put some dump statements in the code and I don't think getDefaultExtension() or getNormalizedLeafName() is the problem. I think the problem is with getDefaultFileName(). If I try to save the image noted in the bug, getDefaultFileName() returns me jn27 instead of jn27#003. (Try doing a view image and you'll only see jn27 in the title). See <http://lxr.mozilla.org/seamonkey/source/xpfe/communicator/resources/content/contentAreaUtils.js#741>. the filename returned here is jn27. I feel this is because nsIURL (?) strips off everything after the # character. It would make sense becase if the URL was index.html#abc, then you'd want the filename to be index.html. Reading the initial bug report again, it seems there are 2 issues, one is the part after # being stripped off and the other is the extension not being used. On my linux system I only see the first issue. When I save the image, the filepicker shows jn27.jpeg as the filename.
Assignee | ||
Comment 15•21 years ago
|
||
That could also be, but in that case I wonder why the image works at all; having a link to "http://foo.com/image#foo.jpeg" should make an HTTP request for "http://foo.com/image". And in fact, if I load http://groups.msn.com/_Secure/0VwDaAuwaoqBR*yThFZuJrMgWfSvAErzV5y!oNDRK0Y3JdLM*sqC7onYUQLq8FX40xW9m7*!JIGcT6emR4Ca!ZsJ!vWpwLl8LoFVUL4wO!nuYsJBQMuNVsQwSDU8noYGB/jn27?dc=4675381664316352864 in my browser (the image url from that page, with the part of the "filename" after '#' removed) I get the right image. So in fact the image filename is "jn27" in this case, even on the server.
Comment 16•21 years ago
|
||
bz: so eh... per your last comment, isn't this invalid?
Assignee | ||
Comment 17•21 years ago
|
||
Not sure. I'd need to trace through the code and see where the stuff after the '#' is lost.... But yes, sounds like it.
Assignee | ||
Comment 18•21 years ago
|
||
Yeah, this is invalid (for the '#' part) and worksforme for the extension part.
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → INVALID
Assignee | ||
Comment 19•21 years ago
|
||
*** Bug 233170 has been marked as a duplicate of this bug. ***
Updated•8 years ago
|
Product: Core → Core Graveyard
You need to log in
before you can comment on or make changes to this bug.
Description
•