From 37b90d6af0e24cb6a08b70cd43189e214a63e923 Mon Sep 17 00:00:00 2001 From: Bogdan Abaev Date: Wed, 14 Jun 2023 15:56:13 -0400 Subject: [PATCH] 404 instead of 500 error on bad groupID or userID Applies to endpoints like /groups/BAD_NAME/items or /users/BAD_NAME/items Fixes: #96 --- controllers/ItemsController.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/controllers/ItemsController.php b/controllers/ItemsController.php index d3a6e4894..9c997911f 100644 --- a/controllers/ItemsController.php +++ b/controllers/ItemsController.php @@ -269,6 +269,10 @@ public function items() { else { $this->allowMethods(array('HEAD', 'GET', 'POST', 'DELETE')); + if (!$this->objectLibraryID){ + $this->e404(); + } + // Check for general library access if (!$this->publications && !$this->permissions->canAccess($this->objectLibraryID)) { $this->e403();