From e398520db024506a90b86d7618a6547146b472a4 Mon Sep 17 00:00:00 2001 From: Vin Howe <24789592+vinhowe@users.noreply.github.com> Date: Mon, 23 Nov 2020 12:41:52 -0700 Subject: [PATCH] Fix MIME check for JPEG in lightbox copy handler (#4643) * Fix MIME check for JPEG in lightbox copy handler * Handle both image/jpeg and non-standard image/jpg --- ts/components/Lightbox.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ts/components/Lightbox.tsx b/ts/components/Lightbox.tsx index 91da37cdb16..b2e09686038 100644 --- a/ts/components/Lightbox.tsx +++ b/ts/components/Lightbox.tsx @@ -425,7 +425,11 @@ export class Lightbox extends React.Component { const { contentType } = this.props; // These are the only image types supported by Electron's NativeImage - if (event && contentType !== 'image/png' && contentType !== 'image/jpg') { + if ( + event && + contentType !== 'image/png' && + !contentType?.match(/image\/jpe?g/g) + ) { event.preventDefault(); } };