Ensure strange urls don't resolve to empty filenames to prevent confusion when resolving duplicates later. b=206319 r=brade sr=jaggernaut a=dbaron

git-svn-id: svn://10.0.0.236/trunk@142811 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
locka%iol.ie
2003-05-23 09:36:32 +00:00
parent be6fafca6e
commit a2edefd4d6

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;