Skip to content

Commit

Permalink
fix: error occurred when add SET key with the same name twice (tiny-c…
Browse files Browse the repository at this point in the history
  • Loading branch information
tiny-craft committed Aug 16, 2024
1 parent c38944e commit 469a623
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions backend/services/browser_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,7 +1243,7 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
if len(param.Format) <= 0 {
param.Format = types.FORMAT_RAW
}
var savedValue string
var savedValue any
switch strings.ToLower(param.KeyType) {
case "string":
if str, ok := param.Value.(string); !ok {
Expand Down Expand Up @@ -1352,9 +1352,11 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
return
}
resp.Success = true
resp.Data = map[string]any{
"value": strutil.EncodeRedisKey(savedValue),
respData := map[string]any{}
if val, ok := savedValue.(string); ok {
respData["value"] = strutil.EncodeRedisKey(val)
}
resp.Data = respData
return
}

Expand Down

0 comments on commit 469a623

Please sign in to comment.