Closed Bug 151843 Opened 23 years ago Closed 23 years ago

nsIFile::Append inconsistent across platforms [was: nsiFile append behaviour changed for empty string]

Categories

(Core :: Networking: HTTP, defect, P4)

x86
Windows 2000
defect

Tracking

()

VERIFIED FIXED
mozilla1.2alpha

People

(Reporter: pwilson, Assigned: darin.moz)

Details

Attachments

(1 file)

The behaviour of the nsIFile (possibly nsILocalFile) append method has changed w.r.t. to the empty string. It used to be possible to do: Win2000 build: 2002061104 aFile.append("") This would take a path and ensure that it terminated with the correct directory separator for the OS. eg File("c:\temp").append("") would yield c:\temp\ on Windows. Appropriate behaviour on Unix would be to use the "/" character. This call now throws an exception. This forces the programmer to discover which OS they are running under and then append the appropriate separator.
Do you use embedding ?
Not embedding, just regular Mozilla.
-> Darin: do you own nsiFile ?
Assignee: Matti → darin
Component: Browser-General → Networking: HTTP
QA Contact: imajes-qa → tever
hmm... why do you need this behavior? i think the original behavior was an unintended side-effect, but i could be wrong about that... cc'ing some other nsIFile folks.
Don't sweat it - I've already worked around the problem.
resolving WONTFIX .. unless someone can correct my assumptions about the meaning of the API.
Status: UNCONFIRMED → RESOLVED
Closed: 23 years ago
Resolution: --- → WONTFIX
can we document this somewhere, like in nsIFile.idl, something to the effect of "unles specified otherwise, null or empty strings are not valid parameters in this interface, and an exception will be thrown"
ah, there is a difference between the XP_WIN and XP_UNIX impls. the XP_UNIX impl just returns NS_OK on AppendNative(""), whereas the XP_WIN version throws an exception! we need to unify these. i think the XP_UNIX behavior makes the most sense. reopening
Status: RESOLVED → UNCONFIRMED
Resolution: WONTFIX → ---
Severity: normal → minor
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Priority: -- → P4
Target Milestone: --- → mozilla1.1beta
Target Milestone: mozilla1.1beta → mozilla1.2alpha
Attached patch v1 patchSplinter Review
this patch touches up the impl of AppendNative for XP_WIN, XP_MAC, and XP_OS2. with this patch, AppendNative now does an early return of NS_OK if the input is an empty string. this seems reasonable, and it shouldn't impact any of the callers since they would otherwise already have a XP_UNIX bug.
Keywords: mozilla1.2, patch
Summary: nsiFile append behaviour changed for empty string → nsIFile::Append inconsistent across platforms [was: nsiFile append behaviour changed for empty string]
Attachment #97490 - Flags: review+
Comment on attachment 97490 [details] [diff] [review] v1 patch r=dougt
Comment on attachment 97490 [details] [diff] [review] v1 patch sr=alecf
Attachment #97490 - Flags: superreview+
fixed-on-trunk
Status: ASSIGNED → RESOLVED
Closed: 23 years ago23 years ago
Resolution: --- → FIXED
verified - checked with Lxr that patch was applied
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: