From 9e268009da6467abfcd03bc899d0925baa076f4c Mon Sep 17 00:00:00 2001 From: Rishabh Date: Wed, 19 Apr 2023 14:31:46 +0100 Subject: [PATCH] Fixed cors error for image editor refs https://github.com/TryGhost/Team/issues/3034 - while fetching the image from source for editing in the image editor, it throws cors error when the image is returned from cache instead of ghost server - the cached image response causes cors to trip over if admin url is different from frontend url for site as it doesn't has the right header - adds a dynamic `v=...` query param while fetching image in editor to bypass cache and fetch image from server directly --- ghost/admin/app/components/koenig-image-editor.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/ghost/admin/app/components/koenig-image-editor.js b/ghost/admin/app/components/koenig-image-editor.js index 9daf1aba44..d45258be65 100644 --- a/ghost/admin/app/components/koenig-image-editor.js +++ b/ghost/admin/app/components/koenig-image-editor.js @@ -113,8 +113,9 @@ export default class KoenigImageEditor extends Component { @action async handleClick() { if (window.pintura) { + const imageSrc = `${this.args.imageSrc}?v=${Date.now()}`; const editor = window.pintura.openDefaultEditor({ - src: this.args.imageSrc, + src: imageSrc, util: 'crop', utils: [ 'crop',