Skip to content

Commit d22bdb0

Browse files
committed
Ensure that the user has specified items to alter in BulkPost
1 parent 36f6951 commit d22bdb0

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

workspace-server/src/main/java/gov/nasa/jpl/aerie/workspace/server/WorkspaceBindings.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,15 @@ public void bulkPost(Context context) throws NoSuchWorkspaceException {
908908
return;
909909
}
910910

911+
// Ensure that the user has specified at least one item to alter
912+
if(items.isEmpty()) {
913+
context.status(400).json(new FormattedError(
914+
"MALFORMED_REQUEST",
915+
"Cannot process request: at least one item must be specified.",
916+
Optional.empty()));
917+
return;
918+
}
919+
911920
// Ensure that no two inputs will try to write to the same location
912921
final var destinationSet = items.stream().map(BulkPostItem::newPath).collect(Collectors.toSet());
913922
if(destinationSet.size() != items.size()) {

0 commit comments

Comments
 (0)