From a5fc45d16942adcc3c5586ceab0b4d0fa1092bde Mon Sep 17 00:00:00 2001 From: Kevin Ansfield Date: Mon, 6 Sep 2021 14:30:03 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fixed=20crash=20when=20newly=20c?= =?UTF-8?q?reated=20images=20are=20dragged=20into=20a=20gallery?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit closes https://github.com/TryGhost/Team/issues/1020 - image card payloads should have a valid `src` attribute, use that instead of relying on the associated `img` element which won't be found/have an unexpected `src` when it's newly created because the image card will still be using the blob url generated for a preview whilst uploading --- .../lib/koenig-editor/addon/components/koenig-card-gallery.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ghost/admin/lib/koenig-editor/addon/components/koenig-card-gallery.js b/ghost/admin/lib/koenig-editor/addon/components/koenig-card-gallery.js index de369e3e1e..e348b603b8 100644 --- a/ghost/admin/lib/koenig-editor/addon/components/koenig-card-gallery.js +++ b/ghost/admin/lib/koenig-editor/addon/components/koenig-card-gallery.js @@ -457,7 +457,7 @@ export default Component.extend({ payload.width = payload.width || img.naturalWidth; payload.height = payload.height || img.naturalHeight; if (!payload.fileName) { - let url = new URL(img.src); + let url = new URL(payload.src || img.src); let fileName = url.pathname.match(/\/([^/]*)$/)[1]; payload.fileName = fileName; }