зеркало из https://github.com/mozilla/pjs.git
Make content-disposition parsing more forgiving. Fixes bug 121509 and a
few existing evang bugs. r=law, sr=mscott
This commit is contained in:
Родитель
68558db0ea
Коммит
cc6df92d27
|
@ -782,7 +782,7 @@ void nsExternalAppHandler::ExtractSuggestedFileNameFromChannel(nsIChannel* aChan
|
|||
nsCAutoString dispositionValue;
|
||||
dispositionValue = disp;
|
||||
PRInt32 pos = dispositionValue.Find("filename=", PR_TRUE);
|
||||
if (pos > 0)
|
||||
if (pos != kNotFound)
|
||||
{
|
||||
// extract everything after the filename= part and treat that as the file name...
|
||||
nsCAutoString dispFileName;
|
||||
|
|
|
@ -311,7 +311,7 @@ nsHeaderSniffer.prototype = {
|
|||
if (name) {
|
||||
const filenamePrefix = "filename=";
|
||||
var ix = name.indexOf(filenamePrefix);
|
||||
if (ix > 0) {
|
||||
if (ix >= 0) {
|
||||
// Adjust ix to point to start of actual name
|
||||
ix += filenamePrefix.length;
|
||||
filename = name.substr(ix, name.length);
|
||||
|
@ -319,7 +319,8 @@ nsHeaderSniffer.prototype = {
|
|||
ix = filename.lastIndexOf(";");
|
||||
if (ix > 0)
|
||||
filename = filename.substr(0, ix);
|
||||
// XXX strip out quotes;
|
||||
|
||||
filename = filename.replace(/^"|"$/g, "");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче