mirror of
https://github.com/HangarMC/Hangar.git
synced 2024-11-27 06:01:08 +08:00
fix(backend): fix missing validation (fixes #1015)
This commit is contained in:
parent
0e8b9e6718
commit
6f0b515a21
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user