Skip to content

Commit

Permalink
fix: can not display correct content with decoder after modified
Browse files Browse the repository at this point in the history
  • Loading branch information
tiny-craft committed Jul 31, 2024
1 parent 237b250 commit 70c38d9
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions backend/services/browser_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1241,7 +1241,7 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
if len(param.Format) <= 0 {
param.Format = types.FORMAT_RAW
}
var savedValue any
var savedValue string
switch strings.ToLower(param.KeyType) {
case "string":
if str, ok := param.Value.(string); !ok {
Expand Down Expand Up @@ -1339,7 +1339,10 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
if err == nil && expiration > 0 {
client.Expire(ctx, key, expiration)
}
savedValue = param.Value
var ok bool
if savedValue, ok = param.Value.(string); !ok {
savedValue = ""
}
}

if err != nil {
Expand All @@ -1348,7 +1351,7 @@ func (b *browserService) SetKeyValue(param types.SetKeyParam) (resp types.JSResp
}
resp.Success = true
resp.Data = map[string]any{
"value": savedValue,
"value": strutil.EncodeRedisKey(savedValue),
}
return
}
Expand Down

0 comments on commit 70c38d9

Please sign in to comment.