зеркало из 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;
|
nsCAutoString dispositionValue;
|
||||||
dispositionValue = disp;
|
dispositionValue = disp;
|
||||||
PRInt32 pos = dispositionValue.Find("filename=", PR_TRUE);
|
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...
|
// extract everything after the filename= part and treat that as the file name...
|
||||||
nsCAutoString dispFileName;
|
nsCAutoString dispFileName;
|
||||||
|
|
|
@ -311,7 +311,7 @@ nsHeaderSniffer.prototype = {
|
||||||
if (name) {
|
if (name) {
|
||||||
const filenamePrefix = "filename=";
|
const filenamePrefix = "filename=";
|
||||||
var ix = name.indexOf(filenamePrefix);
|
var ix = name.indexOf(filenamePrefix);
|
||||||
if (ix > 0) {
|
if (ix >= 0) {
|
||||||
// Adjust ix to point to start of actual name
|
// Adjust ix to point to start of actual name
|
||||||
ix += filenamePrefix.length;
|
ix += filenamePrefix.length;
|
||||||
filename = name.substr(ix, name.length);
|
filename = name.substr(ix, name.length);
|
||||||
|
@ -319,7 +319,8 @@ nsHeaderSniffer.prototype = {
|
||||||
ix = filename.lastIndexOf(";");
|
ix = filename.lastIndexOf(";");
|
||||||
if (ix > 0)
|
if (ix > 0)
|
||||||
filename = filename.substr(0, ix);
|
filename = filename.substr(0, ix);
|
||||||
// XXX strip out quotes;
|
|
||||||
|
filename = filename.replace(/^"|"$/g, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче