Validate input data when uploading, to make sure it's not empty or missing.

This commit is contained in:
CalDescent 2021-12-16 08:47:50 +00:00
parent 1bd493ea37
commit d34fb4494e

View File

@ -416,6 +416,10 @@ public class ArbitraryResource {
String path) {
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);
}
@ -448,6 +452,10 @@ public class ArbitraryResource {
String base64) {
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);
}
@ -482,6 +490,10 @@ public class ArbitraryResource {
String string) {
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);
}
@ -518,6 +530,10 @@ public class ArbitraryResource {
String path) {
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);
}
@ -553,6 +569,10 @@ public class ArbitraryResource {
String string) {
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);
}
@ -586,6 +606,10 @@ public class ArbitraryResource {
String base64) {
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);
}