mirror of
https://github.com/shazow/ssh-chat.git
synced 2025-07-03 04:04:34 +02:00
sanitize: Move global variables to top of file
This commit is contained in:
parent
4c968fc966
commit
c1a8912297
@ -2,7 +2,10 @@ package sanitize
|
|||||||
|
|
||||||
import "regexp"
|
import "regexp"
|
||||||
|
|
||||||
var reStripName = regexp.MustCompile("[^\\w.-]")
|
var (
|
||||||
|
reStripName = regexp.MustCompile("[^\\w.-]")
|
||||||
|
reStripData = regexp.MustCompile("[^[:ascii:]]|[[:cntrl:]]")
|
||||||
|
)
|
||||||
|
|
||||||
const maxLength = 16
|
const maxLength = 16
|
||||||
|
|
||||||
@ -17,8 +20,6 @@ func Name(s string) string {
|
|||||||
return s
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
var reStripData = regexp.MustCompile("[^[:ascii:]]|[[:cntrl:]]")
|
|
||||||
|
|
||||||
// Data returns a string with only allowed characters for client-provided metadata inputs.
|
// Data returns a string with only allowed characters for client-provided metadata inputs.
|
||||||
func Data(s string, maxlen int) string {
|
func Data(s string, maxlen int) string {
|
||||||
if len(s) > maxlen {
|
if len(s) > maxlen {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user