From 07df1e011794f5a77f7fb7da5cd9ea353a8747e2 Mon Sep 17 00:00:00 2001 From: toasted-nutbread Date: Sun, 14 Mar 2021 18:41:15 -0400 Subject: Fix dictionary image support (#1526) * Fix content security policy for images * Add createBlobFromBase64Content to MediaUtil * Update MediaLoader to use MediaUtil * Use blob URLs when importing dictionaries * Update VM's URL to support createObjectURL and revokeObjectURL * Fix test --- ext/js/language/dictionary-importer.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'ext/js/language') diff --git a/ext/js/language/dictionary-importer.js b/ext/js/language/dictionary-importer.js index b4429315..888d19b0 100644 --- a/ext/js/language/dictionary-importer.js +++ b/ext/js/language/dictionary-importer.js @@ -400,7 +400,9 @@ class DictionaryImporter { eventListeners.removeAllEventListeners(); reject(new Error('Image failed to load')); }, false); - image.src = `data:${mediaType};base64,${content}`; + const blob = MediaUtil.createBlobFromBase64Content(content, mediaType); + const url = URL.createObjectURL(blob); + image.src = url; }); } } -- cgit v1.2.3