diff --git a/backend/internal/handler/instance_detail.go b/backend/internal/handler/instance_detail.go index 0636f05..8941b97 100644 --- a/backend/internal/handler/instance_detail.go +++ b/backend/internal/handler/instance_detail.go @@ -717,13 +717,16 @@ func executeRedisQuery(instance *model.Instance, dbSelect string, command string args = append(args, p) } - // For KEYS command, use SCAN with COUNT instead for safety + pagination - if cmd == "KEYS" && strings.Contains(parts[len(parts)-1], "*") { - // Replace KEYS * with SCAN-based pagination + // For KEYS command, use SCAN with pagination (auto-append * if no wildcard) + if cmd == "KEYS" { pattern := "*" if len(parts) > 1 { pattern = parts[1] } + // Auto-append * if pattern has no wildcard + if !strings.Contains(pattern, "*") && !strings.Contains(pattern, "?") && !strings.Contains(pattern, "[") { + pattern = pattern + "*" + } var allKeys []string cursor := uint64(0) maxScan := offset + limit