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:
locka%iol.ie 2003-05-23 09:36:32 +00:00
parent 6a04aff08a
commit acfe636e32

View File

@ -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;