Skip to content

Commit

Permalink
use english character set only for alphanumeric check
Browse files Browse the repository at this point in the history
  • Loading branch information
domcyrus committed Aug 29, 2024
1 parent 8d8dbf7 commit 4ca3f16
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions fastly/helpers.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package fastly

import "unicode"

// MultiConstraint is a generic constraint for ToPointer/ToValue.
type MultiConstraint interface {
[]string | ~string | ~int | int32 | ~int64 | uint | uint8 | uint32 | uint64 | float64 | ~bool
Expand Down Expand Up @@ -37,7 +35,7 @@ func NullString(v string) *string {
// isAlphaNumeric returns true if the string is alphanumeric.
func isAlphanumeric(s string) bool {
for _, r := range s {
if !unicode.IsLetter(r) && !unicode.IsNumber(r) {
if !((r >= 'a' && r <= 'z') || (r >= 'A' && r <= 'Z') || (r >= '0' && r <= '9')) {
return false
}
}
Expand Down

0 comments on commit 4ca3f16

Please sign in to comment.