aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2021-01-30 11:15:11 -0500
committerGitHub <noreply@github.com>2021-01-30 11:15:11 -0500
commitaf6e9a8153c24d0400592005b31d56fecff67068 (patch)
tree2f78c7eb3a7799574b58945697b0ef085c82ccfa
parent588d8a681a34da5777520096a11d5eea74fc2251 (diff)
Fix CSP error when reading images from the clipboard using the paste command (#1328)
-rw-r--r--ext/bg/js/clipboard-reader.js3
1 files changed, 3 insertions, 0 deletions
diff --git a/ext/bg/js/clipboard-reader.js b/ext/bg/js/clipboard-reader.js
index 4fcb480e..8065cb16 100644
--- a/ext/bg/js/clipboard-reader.js
+++ b/ext/bg/js/clipboard-reader.js
@@ -134,6 +134,9 @@ class ClipboardReader {
document.execCommand('paste');
const image = target.querySelector('img[src^="data:"]');
const result = (image !== null ? image.getAttribute('src') : null);
+ for (const image2 of target.querySelectorAll('img')) {
+ image2.removeAttribute('src');
+ }
target.textContent = '';
return result;
}