🐛 Fixed crash when newly created images are dragged into a gallery

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
This commit is contained in:
Kevin Ansfield 2021-09-06 14:30:03 +01:00
parent a0da052471
commit a5fc45d169

View File

@ -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;
}