diff --git a/backend/utils/string/convert.go b/backend/utils/string/convert.go index ff2f293..62a4602 100644 --- a/backend/utils/string/convert.go +++ b/backend/utils/string/convert.go @@ -12,10 +12,10 @@ import ( "github.com/klauspost/compress/gzip" "github.com/klauspost/compress/zstd" "io" + "regexp" "strconv" "strings" "tinyrdm/backend/types" - "unicode/utf8" ) // ConvertTo convert string to specified type @@ -215,9 +215,11 @@ func decodeJson(str string) (string, bool) { } func decodeBase64(str string) (string, bool) { - if decodedStr, err := base64.StdEncoding.DecodeString(str); err == nil { - if s := string(decodedStr); utf8.ValidString(s) { - return s, true + if match, _ := regexp.MatchString(`^\d+$`, str); !match { + if decodedStr, err := base64.StdEncoding.DecodeString(str); err == nil { + if s := string(decodedStr); !containsBinary(s) { + return s, true + } } } return str, false diff --git a/frontend/src/components/content_value/ContentValueHash.vue b/frontend/src/components/content_value/ContentValueHash.vue index 9d91a23..aec8370 100644 --- a/frontend/src/components/content_value/ContentValueHash.vue +++ b/frontend/src/components/content_value/ContentValueHash.vue @@ -131,6 +131,11 @@ const valueColumn = reactive({ } }, }) + +const cancelEdit = () => { + currentEditRow.value.no = 0 +} + const actionColumn = { key: 'action', title: i18n.t('interface.action'), @@ -185,9 +190,7 @@ const actionColumn = { currentEditRow.value.no = 0 } }, - onCancel: () => { - currentEditRow.value.no = 0 - }, + onCancel: cancelEdit, }) }, } @@ -265,6 +268,7 @@ const onUpdateFilter = (filters, sourceColumn) => { defineExpose({ reset: () => { clearFilter() + cancelEdit() }, }) diff --git a/frontend/src/components/content_value/ContentValueList.vue b/frontend/src/components/content_value/ContentValueList.vue index 58dcc7a..97d1247 100644 --- a/frontend/src/components/content_value/ContentValueList.vue +++ b/frontend/src/components/content_value/ContentValueList.vue @@ -89,6 +89,10 @@ const valueColumn = reactive({ }, }) +const cancelEdit = () => { + currentEditRow.value.no = 0 +} + const actionColumn = { key: 'action', title: i18n.t('interface.action'), @@ -141,9 +145,7 @@ const actionColumn = { currentEditRow.value.no = 0 } }, - onCancel: () => { - currentEditRow.value.no = 0 - }, + onCancel: cancelEdit, }) }, } @@ -198,6 +200,7 @@ const onUpdateFilter = (filters, sourceColumn) => { defineExpose({ reset: () => { clearFilter() + cancelEdit() }, }) diff --git a/frontend/src/components/content_value/ContentValueSet.vue b/frontend/src/components/content_value/ContentValueSet.vue index 5ae6c91..3eb9c0e 100644 --- a/frontend/src/components/content_value/ContentValueSet.vue +++ b/frontend/src/components/content_value/ContentValueSet.vue @@ -89,6 +89,11 @@ const valueColumn = reactive({ } }, }) + +const cancelEdit = () => { + currentEditRow.value.no = 0 +} + const actionColumn = { key: 'action', title: i18n.t('interface.action'), @@ -142,9 +147,7 @@ const actionColumn = { currentEditRow.value.no = 0 } }, - onCancel: () => { - currentEditRow.value.no = 0 - }, + onCancel: cancelEdit, }) }, } @@ -199,6 +202,7 @@ const onUpdateFilter = (filters, sourceColumn) => { defineExpose({ reset: () => { clearFilter() + cancelEdit() }, }) diff --git a/frontend/src/components/content_value/ContentValueString.vue b/frontend/src/components/content_value/ContentValueString.vue index 9bb69b8..e2bedbf 100644 --- a/frontend/src/components/content_value/ContentValueString.vue +++ b/frontend/src/components/content_value/ContentValueString.vue @@ -143,6 +143,12 @@ const onSaveValue = async () => { saving.value = false } } + +defineExpose({ + reset: () => { + inEdit.value = false + }, +})