Skip to content

Commit

Permalink
allow underscore in client name
Browse files Browse the repository at this point in the history
  • Loading branch information
kakdeykaushik committed Nov 14, 2024
1 parent 0a0e1c7 commit bc04a30
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/eval/type_string.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func deduceTypeEncoding(v string) (o, e uint8) {

func containsSpacesNewlinesOrSpecialChars(s string) bool {
for _, r := range s {
if unicode.IsSpace(r) || !unicode.IsLetter(r) && !unicode.IsDigit(r) {
if unicode.IsSpace(r) || (!unicode.IsLetter(r) && !unicode.IsDigit(r) && r != '_') {
return true
}
}
Expand Down
5 changes: 3 additions & 2 deletions internal/eval/type_string_test.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package eval

import (
"github.com/dicedb/dice/internal/object"
"testing"

"github.com/dicedb/dice/internal/object"

"github.com/dicedb/dice/internal/server/utils"
)

Expand Down Expand Up @@ -65,11 +66,11 @@ func TestContainsSpacesNewlinesOrSpecialChars(t *testing.T) {
{"NoSpecialChars123", false},
{"HelloWorld123", false},
{"1234567890", false},
{"Hello_World", false},
{"", false},
{"₹₹", true},
{"Hello, World!", true},
{"Hello\nWorld", true},
{"Hello_World", true},
{"\tTabbedText", true},
{"NormalText!", true},
}
Expand Down

0 comments on commit bc04a30

Please sign in to comment.