mirror of
https://github.com/Qortal/qortal.git
synced 2025-04-01 17:55:54 +00:00
Don't allow the custom validation methods to evade superclass validation.
This commit is contained in:
parent
e31515b4a2
commit
c3f19ea0c1
@ -20,7 +20,12 @@ public enum Service {
|
|||||||
ARBITRARY_DATA(100, false, null, null),
|
ARBITRARY_DATA(100, false, null, null),
|
||||||
QCHAT_ATTACHMENT(120, true, 1024*1024L, null) {
|
QCHAT_ATTACHMENT(120, true, 1024*1024L, null) {
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult validate(Path path) {
|
public ValidationResult validate(Path path) throws IOException {
|
||||||
|
ValidationResult superclassResult = super.validate(path);
|
||||||
|
if (superclassResult != ValidationResult.OK) {
|
||||||
|
return superclassResult;
|
||||||
|
}
|
||||||
|
|
||||||
// Custom validation function to require a single file, with a whitelisted extension
|
// Custom validation function to require a single file, with a whitelisted extension
|
||||||
int fileCount = 0;
|
int fileCount = 0;
|
||||||
File[] files = path.toFile().listFiles();
|
File[] files = path.toFile().listFiles();
|
||||||
@ -49,7 +54,12 @@ public enum Service {
|
|||||||
},
|
},
|
||||||
WEBSITE(200, true, null, null) {
|
WEBSITE(200, true, null, null) {
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult validate(Path path) {
|
public ValidationResult validate(Path path) throws IOException {
|
||||||
|
ValidationResult superclassResult = super.validate(path);
|
||||||
|
if (superclassResult != ValidationResult.OK) {
|
||||||
|
return superclassResult;
|
||||||
|
}
|
||||||
|
|
||||||
// Custom validation function to require an index HTML file in the root directory
|
// Custom validation function to require an index HTML file in the root directory
|
||||||
List<String> fileNames = ArbitraryDataRenderer.indexFiles();
|
List<String> fileNames = ArbitraryDataRenderer.indexFiles();
|
||||||
String[] files = path.toFile().list();
|
String[] files = path.toFile().list();
|
||||||
@ -80,7 +90,12 @@ public enum Service {
|
|||||||
METADATA(1100, false, null, null),
|
METADATA(1100, false, null, null),
|
||||||
GIF_REPOSITORY(1200, true, 25*1024*1024L, null) {
|
GIF_REPOSITORY(1200, true, 25*1024*1024L, null) {
|
||||||
@Override
|
@Override
|
||||||
public ValidationResult validate(Path path) {
|
public ValidationResult validate(Path path) throws IOException {
|
||||||
|
ValidationResult superclassResult = super.validate(path);
|
||||||
|
if (superclassResult != ValidationResult.OK) {
|
||||||
|
return superclassResult;
|
||||||
|
}
|
||||||
|
|
||||||
// Custom validation function to require .gif files only, and at least 1
|
// Custom validation function to require .gif files only, and at least 1
|
||||||
int gifCount = 0;
|
int gifCount = 0;
|
||||||
File[] files = path.toFile().listFiles();
|
File[] files = path.toFile().listFiles();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user