mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
Ensure strange urls don't resolve to empty filenames to prevent confusion when resolving duplicates later. b=206319 r=brade sr=jaggernaut a=dbaron
This commit is contained in:
parent
6a04aff08a
commit
acfe636e32
@ -1871,8 +1871,15 @@ nsWebBrowserPersist::MakeFilenameFromURI(nsIURI *aURI, nsString &aFilename)
|
||||
}
|
||||
}
|
||||
|
||||
// Note: Filename could be empty at this point, but we'll deal with that
|
||||
// problem later.
|
||||
// Empty filenames can confuse the local file object later
|
||||
// when it attempts to set the leaf name in CalculateUniqueFilename
|
||||
// for duplicates and ends up replacing the parent dir. To avoid
|
||||
// the problem, all filenames are made at least one character long.
|
||||
if (fileName.IsEmpty())
|
||||
{
|
||||
fileName.Append(PRUnichar('a')); // 'a' is for arbitrary
|
||||
}
|
||||
|
||||
end:
|
||||
aFilename = fileName;
|
||||
return NS_OK;
|
||||
|
Loading…
Reference in New Issue
Block a user