Bug 873065 - Use DEVICESTORAGE_SDCARD for unknown file types. r=dhylands

The method DeviceStorageFile::CreateUnique fails for files with an
unknown extension. It calls DeviceStorageFileChecker::GetTypeFromFileName
to retrieve the default location. The returned value is "Unknown", which
is passed to the constructor of DeviceStorageFile. This class doesn't
handle "Unknown" in it's initialization, and fails without creating a
file.

This patch changes the default return value of GetTypeFromFileName to the
constant DEVICESTORAGE_SDCARD. All files with unknown extension will now
be stored on the sd card.
This commit is contained in:
Thomas Zimmermann 2013-05-16 12:33:18 -04:00
Родитель a44d6902af
Коммит 90691b7347
1 изменённых файлов: 1 добавлений и 1 удалений

Просмотреть файл

@ -334,7 +334,7 @@ DeviceStorageTypeChecker::GetTypeFromFile(nsIFile* aFile, nsAString& aType)
void
DeviceStorageTypeChecker::GetTypeFromFileName(const nsAString& aFileName, nsAString& aType)
{
aType.AssignLiteral("Unknown");
aType.AssignLiteral(DEVICESTORAGE_SDCARD);
nsString fileName(aFileName);
int32_t dotIdx = fileName.RFindChar(PRUnichar('.'));