Browse Source

Reordered invalid PID check to catch more invalidity cases

pull/689/head
Bryan J. Brown 8 years ago
parent
commit
db357e460a
  1. 17
      islandora.module

17
islandora.module

@ -1226,18 +1226,17 @@ function islandora_object_load($object_id) {
return $tuque->repository->getObject(urldecode($object_id)); return $tuque->repository->getObject(urldecode($object_id));
} }
catch (Exception $e) { catch (Exception $e) {
if ($e->getCode() == '404') { // Check to see if invalid PID was passed
module_load_include('inc', 'islandora', 'includes/utilities');
if (!islandora_is_valid_pid($object_id)) {
watchdog('islandora', 'Failed to load invalid PID: @pid', array('@pid' => $object_id), WATCHDOG_ERROR);
return FALSE;
}
elseif ($e->getCode() == '404') {
return FALSE; return FALSE;
} }
else { else {
module_load_include('inc', 'islandora', 'includes/utilities'); return NULL;
if (!islandora_is_valid_pid($object_id)) {
watchdog('islandora', 'Failed to load invalid PID: @pid', array('@pid' => $object_id), WATCHDOG_ERROR);
return FALSE;
}
else {
return NULL;
}
} }
} }
} }

Loading…
Cancel
Save