diff options
Diffstat (limited to 'vendor/github.com/shazow/ssh-chat/internal/sanitize/sanitize.go')
-rw-r--r-- | vendor/github.com/shazow/ssh-chat/internal/sanitize/sanitize.go | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/vendor/github.com/shazow/ssh-chat/internal/sanitize/sanitize.go b/vendor/github.com/shazow/ssh-chat/internal/sanitize/sanitize.go index ed532c97..4f9775f8 100644 --- a/vendor/github.com/shazow/ssh-chat/internal/sanitize/sanitize.go +++ b/vendor/github.com/shazow/ssh-chat/internal/sanitize/sanitize.go @@ -2,7 +2,10 @@ package sanitize import "regexp" -var reStripName = regexp.MustCompile("[^\\w.-]") +var ( + reStripName = regexp.MustCompile("[^\\w.-]") + reStripData = regexp.MustCompile("[^[:ascii:]]|[[:cntrl:]]") +) const maxLength = 16 @@ -17,8 +20,6 @@ func Name(s string) string { return s } -var reStripData = regexp.MustCompile("[^[:ascii:]]|[[:cntrl:]]") - // Data returns a string with only allowed characters for client-provided metadata inputs. func Data(s string, maxlen int) string { if len(s) > maxlen { |