spec update: metadata keys are lowercase

This commit is contained in:
Shivaram Lingamneni 2025-06-22 17:24:14 -04:00
parent cca400de73
commit 3df5b69fba
2 changed files with 5 additions and 2 deletions

View file

@ -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 { func metadataKeyIsEvil(key string) bool {
return !validMetadataKeyRegexp.MatchString(key) return !validMetadataKeyRegexp.MatchString(key)

View file

@ -7,9 +7,12 @@ func TestKeyCheck(t *testing.T) {
input string input string
isEvil bool isEvil bool
}{ }{
{"ImNormal", false}, {"ImNormalButIHaveCaps", true},
{"imnormalandidonthavecaps", false},
{"ergo.chat/vendor-extension", false},
{"", true}, {"", true},
{":imevil", true}, {":imevil", true},
{"im:evil", true},
{"key£with$not%allowed^chars", true}, {"key£with$not%allowed^chars", true},
{"key.thats_completely/normal-and.fine", false}, {"key.thats_completely/normal-and.fine", false},
} }