зеркало из https://github.com/mozilla/pjs.git
final patch for bug 109179 "replace nsStdEscape with NS_EscapeURL"
r=dougt, sr=alecf
This commit is contained in:
Родитель
64902e800e
Коммит
a031f35a63
|
@ -629,15 +629,14 @@ nsMsgFolder::parseURI(PRBool needServer)
|
|||
if (mName.IsEmpty()) {
|
||||
// mName:
|
||||
// the name is the trailing directory in the path
|
||||
nsXPIDLCString fileName;
|
||||
rv = url->GetFileName(getter_Copies(fileName));
|
||||
if (NS_SUCCEEDED(rv) && (const char*)fileName != nsnull) {
|
||||
char *fileName = nsnull;
|
||||
url->GetFileName(&fileName);
|
||||
if (fileName) {
|
||||
// XXX conversion to unicode here? is fileName in UTF8?
|
||||
// yes, let's say it is in utf8
|
||||
|
||||
nsXPIDLCString result;
|
||||
rv = nsStdUnescape((char*)fileName.get(), getter_Copies(result));
|
||||
mName.AssignWithConversion(result);
|
||||
NS_UnescapeURL(fileName);
|
||||
mName = NS_ConvertUTF8toUCS2(fileName);
|
||||
nsMemory::Free(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -689,12 +688,12 @@ nsMsgFolder::parseURI(PRBool needServer)
|
|||
|
||||
// now try to find the local path for this folder
|
||||
if (server) {
|
||||
nsCAutoString newPath;
|
||||
|
||||
nsXPIDLCString urlPath;
|
||||
url->GetFilePath(getter_Copies(urlPath));
|
||||
|
||||
nsXPIDLCString result;
|
||||
rv = nsStdUnescape((char*)urlPath.get(), getter_Copies(result));
|
||||
char *urlPath = nsnull;
|
||||
url->GetFilePath(&urlPath);
|
||||
if (urlPath) {
|
||||
NS_UnescapeURL(urlPath);
|
||||
|
||||
// transform the filepath from the URI, such as
|
||||
// "/folder1/folder2/foldern"
|
||||
|
@ -703,8 +702,10 @@ nsMsgFolder::parseURI(PRBool needServer)
|
|||
// (remove leading / and add .sbd to first n-1 folders)
|
||||
// to be appended onto the server's path
|
||||
|
||||
nsCAutoString newPath;
|
||||
NS_MsgCreatePathStringFromFolderURI(result, newPath);
|
||||
NS_MsgCreatePathStringFromFolderURI(urlPath, newPath);
|
||||
|
||||
nsMemory::Free(urlPath);
|
||||
}
|
||||
|
||||
// now append munged path onto server path
|
||||
nsCOMPtr<nsIFileSpec> serverPath;
|
||||
|
|
|
@ -1554,19 +1554,15 @@ QuotingOutputStreamListener::QuotingOutputStreamListener(const char * originalMs
|
|||
nsXPIDLCString myGetter;
|
||||
if (NS_SUCCEEDED(originalMsgHdr->GetMessageId(getter_Copies(myGetter))))
|
||||
{
|
||||
nsCString unencodedURL(myGetter);
|
||||
// would be nice, if nsXPIDL*String were ns*String
|
||||
nsCAutoString encodedURL;
|
||||
if (!unencodedURL.IsEmpty() && NS_SUCCEEDED(rv))
|
||||
if (!myGetter.IsEmpty())
|
||||
{
|
||||
if (NS_SUCCEEDED(nsStdEscape(unencodedURL.get(),
|
||||
esc_FileBaseName | esc_Forced, encodedURL )))
|
||||
{
|
||||
mCiteReference = NS_LITERAL_STRING("mid:");
|
||||
mCiteReference.AppendWithConversion(encodedURL.get());
|
||||
}
|
||||
const char *escapedMessageId;
|
||||
nsCAutoString buf;
|
||||
if (NS_EscapeURLPart(myGetter.get(), myGetter.Length(), esc_FileBaseName | esc_Forced, buf))
|
||||
escapedMessageId = buf.get();
|
||||
else
|
||||
mCiteReference.Truncate();
|
||||
escapedMessageId = myGetter.get();
|
||||
mCiteReference = NS_LITERAL_STRING("mid") + NS_ConvertASCIItoUCS2(escapedMessageId);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,25 +114,28 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupport
|
|||
|
||||
// okay, now fill in our event sinks...Note that each getter ref counts before
|
||||
// it returns the interface to us...we'll release when we are done
|
||||
nsXPIDLCString fileName;
|
||||
nsXPIDLCString folderName;
|
||||
rv = url->GetFilePath(getter_Copies(fileName));
|
||||
url->GetFileName(getter_Copies(folderName));
|
||||
|
||||
nsXPIDLCString tempfolder;
|
||||
rv = nsStdUnescape((char*)folderName.get(), getter_Copies(tempfolder));
|
||||
char *fileName = nsnull; // may be shortened by NS_UnescapeURL
|
||||
url->GetFilePath(&fileName);
|
||||
|
||||
char *folderName = nsnull; // may be shortened by NS_UnescapeURL
|
||||
url->GetFileName(&folderName);
|
||||
if (folderName)
|
||||
{
|
||||
NS_UnescapeURL(folderName);
|
||||
|
||||
// convert from OS native charset to unicode
|
||||
rv = ConvertToUnicode(nsMsgI18NFileSystemCharset(), tempfolder, m_folderName);
|
||||
rv = ConvertToUnicode(nsMsgI18NFileSystemCharset(), folderName, m_folderName);
|
||||
if (NS_FAILED(rv))
|
||||
m_folderName.AssignWithConversion(tempfolder);
|
||||
m_folderName.AssignWithConversion(folderName);
|
||||
|
||||
nsMemory::Free(folderName);
|
||||
}
|
||||
|
||||
if (fileName)
|
||||
{
|
||||
char* result = nsnull;
|
||||
rv = nsStdUnescape((char*)fileName.get(), &result);
|
||||
nsFilePath dbPath(result);
|
||||
CRTFREEIF(result);
|
||||
NS_UnescapeURL(fileName);
|
||||
nsFilePath dbPath(fileName);
|
||||
nsFileSpec dbName(dbPath);
|
||||
|
||||
// the size of the mailbox file is our total base line for measuring progress
|
||||
|
@ -151,15 +154,15 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartRequest(nsIRequest *request, nsISupport
|
|||
}
|
||||
NS_ASSERTION(m_mailDB, "failed to open mail db parsing folder");
|
||||
#ifdef DEBUG_mscott
|
||||
printf("url file = %s\n", (const char *)fileName);
|
||||
printf("url file = %s\n", fileName);
|
||||
#endif
|
||||
nsMemory::Free(fileName);
|
||||
}
|
||||
}
|
||||
|
||||
// need to get the mailbox name out of the url and call SetMailboxName with it.
|
||||
// then, we need to open the mail db for this parser.
|
||||
return rv;
|
||||
|
||||
}
|
||||
|
||||
// stop binding is a "notification" informing us that the stream associated with aURL is going away.
|
||||
|
@ -181,7 +184,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIRequest *request, nsISupports
|
|||
nsCAutoString author;
|
||||
nsCAutoString subject;
|
||||
|
||||
// m_mailDB->PrePopulate();
|
||||
// m_mailDB->PrePopulate();
|
||||
m_mailDB->ListAllKeys(keys);
|
||||
PRUint32 size = keys.GetSize();
|
||||
for (PRUint32 keyindex = 0; keyindex < size; keyindex++)
|
||||
|
@ -214,7 +217,6 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStopRequest(nsIRequest *request, nsISupports
|
|||
UpdateStatusText(LOCAL_STATUS_DOCUMENT_DONE);
|
||||
|
||||
return NS_OK;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -1860,19 +1860,18 @@ nsFtpState::Init(nsIFTPChannel* aChannel,
|
|||
rv = aURL->GetFilePath(&path);
|
||||
else
|
||||
rv = mURL->GetPath(&path);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Skip leading slash
|
||||
char* fwdPtr= NS_CONST_CAST(char*, path);
|
||||
char* fwdPtr= path;
|
||||
if (fwdPtr && (*fwdPtr == '/'))
|
||||
fwdPtr++;
|
||||
if (*fwdPtr != '\0') {
|
||||
// now unescape it
|
||||
char *unescPath = nsnull;
|
||||
nsStdUnescape(fwdPtr,&unescPath);
|
||||
nsMemory::Free(path);
|
||||
mPath.Adopt(unescPath);
|
||||
// now unescape it... %xx reduced inline to resulting character
|
||||
NS_UnescapeURL(fwdPtr);
|
||||
mPath.Assign(fwdPtr);
|
||||
}
|
||||
nsMemory::Free(path);
|
||||
|
||||
// pull any username and/or password out of the uri
|
||||
nsXPIDLCString uname;
|
||||
|
|
|
@ -201,7 +201,7 @@ private:
|
|||
nsCOMPtr<nsIURI> mURL; // the uri we're connecting to
|
||||
PRInt32 mPort; // the port to connect to
|
||||
nsAutoString mFilename; // url filename (if any)
|
||||
nsXPIDLCString mPath; // the url's path
|
||||
nsCString mPath; // the url's path
|
||||
nsCString mPwd; // login Path
|
||||
|
||||
// ****** other vars
|
||||
|
|
|
@ -900,16 +900,13 @@ nsresult nsExternalAppHandler::SetUpTempFile(nsIChannel * aChannel)
|
|||
{
|
||||
// try to extract the file name from the url and use that as a first pass as the
|
||||
// leaf name of our temp file...
|
||||
nsXPIDLCString leafName;
|
||||
url->GetFileName(getter_Copies(leafName));
|
||||
if (leafName.get())
|
||||
char *leafName = nsnull; // may be shortened by NS_UnescapeURL
|
||||
url->GetFileName(&leafName);
|
||||
if (leafName)
|
||||
{
|
||||
nsXPIDLCString unescapedFileName;
|
||||
rv = nsStdUnescape((char*)leafName.get(), getter_Copies(unescapedFileName));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mSuggestedFileName.Assign(NS_ConvertUTF8toUCS2(unescapedFileName));
|
||||
else
|
||||
mSuggestedFileName.AssignWithConversion(leafName);
|
||||
NS_UnescapeURL(leafName);
|
||||
mSuggestedFileName = NS_ConvertUTF8toUCS2(leafName);
|
||||
nsMemory::Free(leafName);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче