File tree 3 files changed +7
-5
lines changed
3 files changed +7
-5
lines changed Original file line number Diff line number Diff line change 6
6
HostStatusClosing = 2
7
7
8
8
RoomIdLen = 32
9
- RoomIdPattern = "^[0-9a-f]+ $"
9
+ RoomIdPattern = "^[0-9a-f]{32} $"
10
10
)
Original file line number Diff line number Diff line change @@ -84,7 +84,7 @@ func RandomHex(n int) string {
84
84
}
85
85
86
86
func IsValidRoomId (id string ) bool {
87
- return rerid .Match ([] byte ( id ) )
87
+ return rerid .MatchString ( id )
88
88
}
89
89
90
90
type Repository struct {
Original file line number Diff line number Diff line change @@ -40,9 +40,11 @@ func TestQueries(t *testing.T) {
40
40
41
41
func TestIsValidRoomId (t * testing.T ) {
42
42
tests := map [string ]bool {
43
- "123456789abcdef" : true ,
44
- "123456789ABCDEF" : false ,
45
- "" : false ,
43
+ "0123456789abcdef0123456789abcdef" : true ,
44
+ "0123456789ABCDEF0123456789ABCDEF" : false ,
45
+ "0123456789abcdef0123456789abcde" : false ,
46
+ "0123456789abcdef0123456789abcdef0" : false ,
47
+ "" : false ,
46
48
}
47
49
48
50
for id , valid := range tests {
You can’t perform that action at this time.
0 commit comments