Bug 1335982 - for trash folder use proper URI parsing instead of home-made parsing (analysis by Gene Smith). r=GeneSmith

This commit is contained in:
Jorg K 2018-01-01 18:28:40 +01:00
Родитель d301334f6b
Коммит cbfad7d28a
1 изменённых файлов: 6 добавлений и 2 удалений

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

@ -44,6 +44,7 @@
#include "nsComponentManagerUtils.h"
#include "nsCRTGlue.h"
#include "mozilla/Services.h"
#include "nsNetUtil.h"
using namespace mozilla;
@ -1562,9 +1563,12 @@ NS_IMETHODIMP nsImapIncomingServer::DiscoveryDone()
// localized.
nsAutoCString trashURL;
trashFolder->GetFolderURL(trashURL);
int32_t leafPos = trashURL.RFindChar('/');
nsCOMPtr<nsIURI> uri;
NS_NewURI(getter_AddRefs(uri), trashURL);
nsAutoCString trashPath;
uri->GetPathQueryRef(trashPath);
nsAutoCString unescapedName;
MsgUnescapeString(Substring(trashURL, leafPos + 1),
MsgUnescapeString(Substring(trashPath, 1), // Skip leading slash.
nsINetUtil::ESCAPE_URL_PATH, unescapedName);
nsAutoString nameUnicode;
if (NS_FAILED(CopyMUTF7toUTF16(unescapedName, nameUnicode)) ||