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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user