mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
don't trim spaces before validating the key
This commit is contained in:
parent
1f546bad9c
commit
d99eba20d8
1 changed files with 0 additions and 3 deletions
|
|
@ -5,7 +5,6 @@ import (
|
||||||
"iter"
|
"iter"
|
||||||
"maps"
|
"maps"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
|
||||||
|
|
||||||
"github.com/ergochat/ergo/irc/caps"
|
"github.com/ergochat/ergo/irc/caps"
|
||||||
"github.com/ergochat/ergo/irc/modes"
|
"github.com/ergochat/ergo/irc/modes"
|
||||||
|
|
@ -109,8 +108,6 @@ func syncChannelMetadata(server *Server, rb *ResponseBuffer, channel *Channel) {
|
||||||
var metadataEvilCharsRegexp = regexp.MustCompile("[^A-Za-z0-9_./:-]+")
|
var metadataEvilCharsRegexp = regexp.MustCompile("[^A-Za-z0-9_./:-]+")
|
||||||
|
|
||||||
func metadataKeyIsEvil(key string) bool {
|
func metadataKeyIsEvil(key string) bool {
|
||||||
key = strings.TrimSpace(key) // just in case
|
|
||||||
|
|
||||||
return len(key) == 0 || // key needs to contain stuff
|
return len(key) == 0 || // key needs to contain stuff
|
||||||
key[0] == ':' || // key can't start with a colon
|
key[0] == ':' || // key can't start with a colon
|
||||||
metadataEvilCharsRegexp.MatchString(key) // key can't contain the stuff it can't contain
|
metadataEvilCharsRegexp.MatchString(key) // key can't contain the stuff it can't contain
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue