Closed
Bug 4184
Opened 26 years ago
Closed 26 years ago
nsFileURL doubly escapes its escaped input string
Categories
(Core :: XPCOM, defect, P2)
Tracking
()
RESOLVED
FIXED
M6
People
(Reporter: mozilla, Assigned: mcmullen)
Details
(Whiteboard: Fixed, awaiting tree reopen after M5)
On Windows, calling GetLeafName() on a nsFileURL doesn't unescape the leaf name.
Run apprunner, load in "resource:/res/rdf/sidebar.xul" and open up the "File
System" container. You'll see all available drives. Open up "C:"... and look for
"file:///C|/Program%20Files/". Its leaf name should be displayed as "Program
Files" but since GetLeafName() isn't unescaping the name, its being displayed as
"Program%20Files".
Reporter | ||
Updated•26 years ago
|
Priority: P3 → P2
I don't understand this, really, because GetLeafName is not a method of
nsFileURL, but rather of nsFileSpec. Is the problem that nsFileSpec ends up with
an escaped name? If so, how was the spec made? (I conjectured at first that the
spec was made from a URL, and that the bug is that unescaping is not occurring.
However, looking at the code, I see that unescaping is happening in this case.)
Could you give me a reference to the code path that leads to this phenomenon?
Reporter | ||
Comment 2•26 years ago
|
||
Here's a code snippet:
const char *uri = __some escaped files URL__;
nsFileURL url(uri);
nsNativeFileSpec native(url);
char *basename = native.GetLeafName();
Status: NEW → RESOLVED
Closed: 26 years ago
Resolution: --- → FIXED
Reporter | ||
Updated•26 years ago
|
Status: RESOLVED → REOPENED
Reporter | ||
Comment 4•26 years ago
|
||
Reopening this bug as it has returned. Also, cc'ing dougt.
I did spot one problem, and checked in a fix for it. I haven't tested it yet, so
I'm not presuming to mark it fixed. Feel free to update mozilla/base to get the
current fix.
OK, Robert, now I'm confused. The tree widget on windows is still displaying full
URLs (instead of leaf names), so how do I reproduce this bug?
Reporter | ||
Comment 8•26 years ago
|
||
I pulled your fix; the bug still persists. :^(
John, I'm confused when you say that the tree widget is displaying full URLs.
The first column should be the name column [as returned by GetLeafName()], with
the second column being the full URL.
Status: REOPENED → ASSIGNED
Summary: GetLeafName() doesn't unescape name → nsFileURL doubly escapes its escaped input string
Assignee | ||
Comment 10•26 years ago
|
||
Solved. Fixed (to be checked in after M5). The problem is actually that the two
constructors of nsFileURL that take a string parameter were passing the string to
the constructor of nsFilePath without UNESCAPING it. So the strings in nsFileURL
were doubly escaped.
Changed summary from "GetLeafName() doesn't unescape name" to "nsFileURL doubly
escapes its escaped input string"
Status: ASSIGNED → RESOLVED
Closed: 26 years ago → 26 years ago
Resolution: --- → FIXED
Assignee | ||
Comment 11•26 years ago
|
||
Fix checked in.
Comment 12•25 years ago
|
||
Bulk moving to XPCOM, in preparation for removal of XP File Handling component.
(XPFH has received two bugs in ~5 months, and is no longer in active use.)
Component: XP File Handling → XPCOM
You need to log in
before you can comment on or make changes to this bug.
Description
•