fix(backend): fix missing validation (fixes #1015)

This commit is contained in:
MiniDigger | Martin 2022-11-10 11:03:59 +01:00
parent 0e8b9e6718
commit 6f0b515a21

View File

@ -7,6 +7,7 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.regex.Pattern;
import io.papermc.hangar.util.PatternWrapper;
@Component
public class Validations {
@ -19,6 +20,11 @@ public class Validations {
return pattern.matcher(value).matches();
}
public boolean regex(String value, PatternWrapper regex) {
if (isEmpty(value)) return true;
return regex.test(value);
}
public boolean required(String value) {
return !isEmpty(value);
}