From 2f62a4e1c2a4dfddff3a22c2c64cec90bc83ef15 Mon Sep 17 00:00:00 2001 From: Varun Patil Date: Sun, 16 Apr 2023 10:09:40 -0700 Subject: [PATCH] editor: fix saving name Signed-off-by: Varun Patil --- src/components/viewer/ImageEditor.vue | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/viewer/ImageEditor.vue b/src/components/viewer/ImageEditor.vue index e386ebc8..9c19937a 100644 --- a/src/components/viewer/ImageEditor.vue +++ b/src/components/viewer/ImageEditor.vue @@ -169,6 +169,7 @@ export default defineComponent({ methods: { async getImage(): Promise { const img = new Image(); + img.name = this.photo.basename; await new Promise(async (resolve) => { img.onload = resolve; @@ -225,9 +226,16 @@ export default defineComponent({ }; } + // Make sure we have an extension + let name = data.name; + const nameLower = name.toLowerCase(); + if (!nameLower.endsWith(data.extension) && !nameLower.endsWith(".jpg")) { + name += "." + data.extension; + } + try { const res = await axios.put(API.IMAGE_EDIT(this.photo.fileid), { - name: data.name, + name: name, width: data.width, height: data.height, quality: data.quality,