mirror of
https://codeberg.org/nobody/LocalCDN.git
synced 2025-01-10 17:23:18 +01:00
Updated charset check
This commit is contained in:
parent
14c0adc281
commit
5614551d1b
@ -43,15 +43,16 @@ manipulateDOM._removeCrossOriginAndIntegrityAttr = function (details) {
|
|||||||
|
|
||||||
let asciiDecoder, decoder, encoder, charset, isFirstData, filter;
|
let asciiDecoder, decoder, encoder, charset, isFirstData, filter;
|
||||||
|
|
||||||
asciiDecoder = new TextDecoder('ASCII');
|
|
||||||
encoder = new TextEncoder();
|
|
||||||
charset = /charset\s*=/.test(header.value) && header.value.replace(/^.*?charset\s*=\s*/, '').replace(/["']?/g, '');
|
charset = /charset\s*=/.test(header.value) && header.value.replace(/^.*?charset\s*=\s*/, '').replace(/["']?/g, '');
|
||||||
|
|
||||||
// Check if charset is supported by TextDecoder()
|
// Check if charset is supported by TextDecoder()
|
||||||
if(EncodingTypes[charset.toString().toLowerCase()] == undefined){
|
if(/charset\s*=/.test(header.value) && !EncodingTypes[charset.toString().toLowerCase()]){
|
||||||
charset = false;
|
console.error('[ LocalCDN ] Unsupported charset: ' + charset);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
asciiDecoder = new TextDecoder('ASCII');
|
||||||
|
encoder = new TextEncoder();
|
||||||
isFirstData = true;
|
isFirstData = true;
|
||||||
filter = browser.webRequest.filterResponseData(details.requestId);
|
filter = browser.webRequest.filterResponseData(details.requestId);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user