forked from Qortal/qortal
Validate input data when uploading, to make sure it's not empty or missing.
This commit is contained in:
parent
1bd493ea37
commit
d34fb4494e
@ -416,6 +416,10 @@ public class ArbitraryResource {
|
|||||||
String path) {
|
String path) {
|
||||||
Security.checkApiCallAllowed(request);
|
Security.checkApiCallAllowed(request);
|
||||||
|
|
||||||
|
if (path == null || path.isEmpty()) {
|
||||||
|
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "Path not supplied");
|
||||||
|
}
|
||||||
|
|
||||||
return this.upload(Service.valueOf(serviceString), name, null, path, null, null);
|
return this.upload(Service.valueOf(serviceString), name, null, path, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,6 +452,10 @@ public class ArbitraryResource {
|
|||||||
String base64) {
|
String base64) {
|
||||||
Security.checkApiCallAllowed(request);
|
Security.checkApiCallAllowed(request);
|
||||||
|
|
||||||
|
if (base64 == null) {
|
||||||
|
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "Data not supplied");
|
||||||
|
}
|
||||||
|
|
||||||
return this.upload(Service.valueOf(serviceString), name, null, null, null, base64);
|
return this.upload(Service.valueOf(serviceString), name, null, null, null, base64);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -482,6 +490,10 @@ public class ArbitraryResource {
|
|||||||
String string) {
|
String string) {
|
||||||
Security.checkApiCallAllowed(request);
|
Security.checkApiCallAllowed(request);
|
||||||
|
|
||||||
|
if (string == null || string.isEmpty()) {
|
||||||
|
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "Data string not supplied");
|
||||||
|
}
|
||||||
|
|
||||||
return this.upload(Service.valueOf(serviceString), name, null, null, string, null);
|
return this.upload(Service.valueOf(serviceString), name, null, null, string, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -518,6 +530,10 @@ public class ArbitraryResource {
|
|||||||
String path) {
|
String path) {
|
||||||
Security.checkApiCallAllowed(request);
|
Security.checkApiCallAllowed(request);
|
||||||
|
|
||||||
|
if (path == null || path.isEmpty()) {
|
||||||
|
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "Path not supplied");
|
||||||
|
}
|
||||||
|
|
||||||
return this.upload(Service.valueOf(serviceString), name, identifier, path, null, null);
|
return this.upload(Service.valueOf(serviceString), name, identifier, path, null, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,6 +569,10 @@ public class ArbitraryResource {
|
|||||||
String string) {
|
String string) {
|
||||||
Security.checkApiCallAllowed(request);
|
Security.checkApiCallAllowed(request);
|
||||||
|
|
||||||
|
if (string == null || string.isEmpty()) {
|
||||||
|
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "Data string not supplied");
|
||||||
|
}
|
||||||
|
|
||||||
return this.upload(Service.valueOf(serviceString), name, identifier, null, string, null);
|
return this.upload(Service.valueOf(serviceString), name, identifier, null, string, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,6 +606,10 @@ public class ArbitraryResource {
|
|||||||
String base64) {
|
String base64) {
|
||||||
Security.checkApiCallAllowed(request);
|
Security.checkApiCallAllowed(request);
|
||||||
|
|
||||||
|
if (base64 == null) {
|
||||||
|
throw ApiExceptionFactory.INSTANCE.createCustomException(request, ApiError.INVALID_CRITERIA, "Data not supplied");
|
||||||
|
}
|
||||||
|
|
||||||
return this.upload(Service.valueOf(serviceString), name, identifier, null, null, base64);
|
return this.upload(Service.valueOf(serviceString), name, identifier, null, null, base64);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user