Merge pull request #7642 from Rob--W/crx-type-from-content-disposition-header
Deduct file type from content-disposition if needed
This commit is contained in:
commit
c0e82dbc38
@ -73,9 +73,19 @@ function isPdfFile(details) {
|
|||||||
var header = getHeaderFromHeaders(details.responseHeaders, 'content-type');
|
var header = getHeaderFromHeaders(details.responseHeaders, 'content-type');
|
||||||
if (header) {
|
if (header) {
|
||||||
var headerValue = header.value.toLowerCase().split(';',1)[0].trim();
|
var headerValue = header.value.toLowerCase().split(';',1)[0].trim();
|
||||||
return (headerValue === 'application/pdf' ||
|
if (headerValue === 'application/pdf') {
|
||||||
headerValue === 'application/octet-stream' &&
|
return true;
|
||||||
details.url.toLowerCase().indexOf('.pdf') > 0);
|
}
|
||||||
|
if (headerValue === 'application/octet-stream') {
|
||||||
|
if (details.url.toLowerCase().indexOf('.pdf') > 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var cdHeader =
|
||||||
|
getHeaderFromHeaders(details.responseHeaders, 'content-disposition');
|
||||||
|
if (cdHeader && /\.pdf(["']|$)/i.test(cdHeader.value)) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user