mirror of
https://github.com/ergochat/ergo.git
synced 2025-12-20 02:00:11 -08:00
spec update: metadata keys are lowercase
This commit is contained in:
parent
cca400de73
commit
3df5b69fba
2 changed files with 5 additions and 2 deletions
|
|
@ -106,7 +106,7 @@ func syncChannelMetadata(server *Server, rb *ResponseBuffer, channel *Channel) {
|
|||
}
|
||||
}
|
||||
|
||||
var validMetadataKeyRegexp = regexp.MustCompile("^[A-Za-z0-9_./-]+$")
|
||||
var validMetadataKeyRegexp = regexp.MustCompile("^[a-z0-9_./-]+$")
|
||||
|
||||
func metadataKeyIsEvil(key string) bool {
|
||||
return !validMetadataKeyRegexp.MatchString(key)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,12 @@ func TestKeyCheck(t *testing.T) {
|
|||
input string
|
||||
isEvil bool
|
||||
}{
|
||||
{"ImNormal", false},
|
||||
{"ImNormalButIHaveCaps", true},
|
||||
{"imnormalandidonthavecaps", false},
|
||||
{"ergo.chat/vendor-extension", false},
|
||||
{"", true},
|
||||
{":imevil", true},
|
||||
{"im:evil", true},
|
||||
{"key£with$not%allowed^chars", true},
|
||||
{"key.thats_completely/normal-and.fine", false},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue