aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhenriquez <obsessivefacts@protonmail.com>2020-04-07 00:07:52 -0500
committerYuchen Pei <hi@ypei.me>2022-06-23 00:02:13 +1000
commit3d8b24e2b0b7779f03dc4cee9571b2ecd3025805 (patch)
tree82dc3ec5ce16fb8dcfff5e1cb5f547aba25e3267
parent5f2496ae037baa3a676ec1a18ca6c207da6601fa (diff)
fix subresource integrity hash-busting bug by only rewriting external scripts if not 'accepted'
-rw-r--r--bg/ResponseProcessor.js2
1 files changed, 1 insertions, 1 deletions
diff --git a/bg/ResponseProcessor.js b/bg/ResponseProcessor.js
index d964dab..0340a6f 100644
--- a/bg/ResponseProcessor.js
+++ b/bg/ResponseProcessor.js
@@ -117,7 +117,7 @@ class ResponseTextFilter {
} catch (e) {
console.error(e);
}
- if (editedText !== null) {
+ if (editedText !== null && editedText.indexOf('/* LibreJS: script accepted') !== 0) {
// we changed the content, let's re-encode
let encoded = new TextEncoder().encode(editedText);
// pre-pending the UTF-8 BOM will force the charset per HTML 5 specs