Bug #374259 --> bad things happen when you create a saved search in an inbox subfolder whose name starts with a '.'. sr=bienvenu

This commit is contained in:
scott%scott-macgregor.org 2007-03-21 01:34:29 +00:00
Родитель 5702599b35
Коммит 5095d608ff
1 изменённых файлов: 30 добавлений и 25 удалений

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

@ -202,17 +202,22 @@ function onOK()
}
else if (name && uri) // create a new virtual folder
{
// check to see if we already have a folder with the same name and alert the user if so...
var parentFolder = GetMsgFolderFromUri(uri);
if (parentFolder.containsChildNamed(name))
// sanity check the name based on the logic used by nsMsgBaseUtils.cpp. It can't start with a '.', it can't end with a '.', '~' or ' '.
// it can't contain a ';' or '#'.
if (/^\.|[\.\~ ]$|[\;\#]/.test(name))
{
window.alert(messengerBundle.getString('folderCreationFailed'));
return false;
}
else if (parentFolder.containsChildNamed(name))
{
window.alert(messengerBundle.getString('folderExists'));
return false;
}
// XXX: Add code to make sure a folder with this name does not already exist before creating the virtual folder...
// Alert the user here if that is the case.
saveSearchTerms(gSearchTermSession.searchTerms, gSearchTermSession);
CreateVirtualFolder(name, parentFolder, gSearchFolderURIs, gSearchTermSession.searchTerms, searchOnline);
}