From b79231903afbcf4fe07a9340d39dc372d49af5ea Mon Sep 17 00:00:00 2001 From: Ryan Wang Date: Wed, 19 Jun 2024 23:42:40 +0800 Subject: [PATCH] fix: counter extension data can not be updated Signed-off-by: Ryan Wang --- ui/src/views/components/DataUpdateSection.vue | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/src/views/components/DataUpdateSection.vue b/ui/src/views/components/DataUpdateSection.vue index 8c49312..ca44674 100644 --- a/ui/src/views/components/DataUpdateSection.vue +++ b/ui/src/views/components/DataUpdateSection.vue @@ -28,10 +28,12 @@ const isSubmitting = ref(false); async function handleSave() { try { isSubmitting.value = true; - await axios.put( - `${buildBaseApiUrl(props.scheme)}/${props.data?.metadata?.name}`, - dataEditorRef.value?.getData() - ); + + // metadata.name may appear in a form similar to `posts.content.halo.run/5152aea5-c2e8-4717-8bba-2263d46e19d5` + // so we need to use encodeURIComponent + const name = encodeURIComponent(props.data?.metadata?.name); + + await axios.put(`${buildBaseApiUrl(props.scheme)}/${name}`, dataEditorRef.value?.getData()); Toast.success('保存成功'); queryClient.invalidateQueries({ queryKey: ['plugin-data-studio:data'] }); } catch (error) {