1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-11-24 08:57:03 -05:00

Add suffix checking helper

This commit is contained in:
erik 2023-12-21 14:22:42 +01:00 committed by Michael Jerger
parent c887bddb72
commit 48cfb521d1

View file

@ -151,3 +151,7 @@ func ValidateOneOf(value string, allowed []string) []string {
} }
return []string{fmt.Sprintf("Value %v is not contained in allowed values [%v]", value, allowed)} return []string{fmt.Sprintf("Value %v is not contained in allowed values [%v]", value, allowed)}
} }
func ValidateSuffix(str, suffix string) bool {
return strings.HasSuffix(str, suffix)
}