From fbcac6d3e49fab77539288cfceb6924998e4ce22 Mon Sep 17 00:00:00 2001 From: Nolan Lawson Date: Tue, 23 Jul 2019 20:33:22 -0700 Subject: [PATCH] fix: fix Firefox img.decode bug (#1357) * fix: fix Firefox img.decode bug Fixes #1344 * fix error --- src/routes/_utils/decodeImage.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/routes/_utils/decodeImage.js b/src/routes/_utils/decodeImage.js index 0efbc12c..d4407e2d 100644 --- a/src/routes/_utils/decodeImage.js +++ b/src/routes/_utils/decodeImage.js @@ -1,5 +1,10 @@ +const IS_FIREFOX = process.browser && /Firefox/.test(navigator.userAgent) + export function decodeImage (img) { - if (typeof img.decode === 'function') { + // Remove this UA sniff when the Firefox bug is fixed + // https://github.com/nolanlawson/pinafore/issues/1344#issuecomment-514312672 + // https://bugzilla.mozilla.org/show_bug.cgi?id=1565542 + if (!IS_FIREFOX && typeof img.decode === 'function') { return img.decode() }