From 67666f4edfccdf53b1d0042cc00f8b33e56ee6fe Mon Sep 17 00:00:00 2001
From: tiny-craft <137850705+tiny-craft@users.noreply.github.com>
Date: Thu, 2 Nov 2023 16:27:55 +0800
Subject: [PATCH] fix: unable to decode json string with prefix or suffix
contains space or line break
---
backend/utils/string/convert.go | 10 ++++++----
.../content_value/DropdownSelector.vue | 16 +++++++++++++++-
frontend/src/styles/style.scss | 13 -------------
3 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/backend/utils/string/convert.go b/backend/utils/string/convert.go
index 792884d..ff2f293 100644
--- a/backend/utils/string/convert.go
+++ b/backend/utils/string/convert.go
@@ -117,10 +117,11 @@ func autoDecode(str string) (value, resultDecode string) {
return
}
- if value, ok = decodeDeflate(str); ok {
- resultDecode = types.DECODE_DEFLATE
- return
- }
+ // FIXME: skip decompress with deflate due to incorrect format checking
+ //if value, ok = decodeDeflate(str); ok {
+ // resultDecode = types.DECODE_DEFLATE
+ // return
+ //}
if value, ok = decodeZStd(str); ok {
resultDecode = types.DECODE_ZSTD
@@ -202,6 +203,7 @@ func autoViewAs(str string) (value, resultFormat string) {
}
func decodeJson(str string) (string, bool) {
+ str = strings.TrimSpace(str)
if (strings.HasPrefix(str, "{") && strings.HasSuffix(str, "}")) ||
(strings.HasPrefix(str, "[") && strings.HasSuffix(str, "]")) {
var out bytes.Buffer
diff --git a/frontend/src/components/content_value/DropdownSelector.vue b/frontend/src/components/content_value/DropdownSelector.vue
index 90c294c..00d0dae 100644
--- a/frontend/src/components/content_value/DropdownSelector.vue
+++ b/frontend/src/components/content_value/DropdownSelector.vue
@@ -91,4 +91,18 @@ const onDropdownShow = (show) => {
-
+
diff --git a/frontend/src/styles/style.scss b/frontend/src/styles/style.scss
index 79d456f..9fa4d3e 100644
--- a/frontend/src/styles/style.scss
+++ b/frontend/src/styles/style.scss
@@ -121,19 +121,6 @@ body {
padding-right: 10px;
}
-.type-selector-header {
- height: 30px;
- line-height: 30px;
- font-size: 15px;
- font-weight: bold;
- text-align: center;
-}
-
-.type-selector-item {
- min-width: 100px;
- text-align: center;
-}
-
.nav-pane-container {
overflow: hidden;