Fall back to ISO-8859-1 in content_disposition.js
Updates content_disposition.js to include
9b789d9b3b
This commit is contained in:
parent
e992480baa
commit
0e4e79169b
@ -107,7 +107,11 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
|
|||||||
function fixupEncoding(value) {
|
function fixupEncoding(value) {
|
||||||
if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
|
if (needsEncodingFixup && /[\x80-\xff]/.test(value)) {
|
||||||
// Maybe multi-byte UTF-8.
|
// Maybe multi-byte UTF-8.
|
||||||
return textdecode('utf-8', value);
|
value = textdecode('utf-8', value);
|
||||||
|
if (needsEncodingFixup) {
|
||||||
|
// Try iso-8859-1 encoding.
|
||||||
|
value = textdecode('iso-8859-1', value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return value;
|
return value;
|
||||||
}
|
}
|
||||||
@ -209,10 +213,10 @@ function getFilenameFromContentDispositionHeader(contentDisposition) {
|
|||||||
return textdecode(charset, text);
|
return textdecode(charset, text);
|
||||||
} // else encoding is b or B - base64 (RFC 2047 section 4.1)
|
} // else encoding is b or B - base64 (RFC 2047 section 4.1)
|
||||||
try {
|
try {
|
||||||
return atob(text);
|
text = atob(text);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return text;
|
|
||||||
}
|
}
|
||||||
|
return textdecode(charset, text);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user