mirror of
https://github.com/bluenviron/mediamtx
synced 2025-01-20 22:21:01 +00:00
parent
d72dab858e
commit
e426810455
@ -7,9 +7,9 @@ import (
|
||||
"strings"
|
||||
)
|
||||
|
||||
var reCredential = regexp.MustCompile(`^[a-zA-Z0-9!\$\(\)\*\+\.;<=>\[\]\^_\-\{\}]+$`)
|
||||
var reCredential = regexp.MustCompile(`^[a-zA-Z0-9!\$\(\)\*\+\.;<=>\[\]\^_\-\{\}@#&]+$`)
|
||||
|
||||
const credentialSupportedChars = "A-Z,0-9,!,$,(,),*,+,.,;,<,=,>,[,],^,_,-,{,}"
|
||||
const credentialSupportedChars = "A-Z,0-9,!,$,(,),*,+,.,;,<,=,>,[,],^,_,-,\",\",@,#,&"
|
||||
|
||||
// Credential is a parameter that is used as username or password.
|
||||
type Credential string
|
||||
@ -29,7 +29,7 @@ func (d *Credential) UnmarshalJSON(b []byte) error {
|
||||
if in != "" &&
|
||||
!strings.HasPrefix(in, "sha256:") &&
|
||||
!reCredential.MatchString(in) {
|
||||
return fmt.Errorf("contains unsupported characters (supported are %s)", credentialSupportedChars)
|
||||
return fmt.Errorf("credential contains unsupported characters. Supported are: %s", credentialSupportedChars)
|
||||
}
|
||||
|
||||
*d = Credential(in)
|
||||
|
Loading…
Reference in New Issue
Block a user