Browse Source

Code review feedback

Return the current value of $return if we have a bad value.
pull/704/head
Jonathan Green 7 years ago committed by GitHub
parent
commit
7d9cdc220b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      includes/datastream.inc

10
includes/datastream.inc

@ -161,7 +161,10 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) {
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
$modified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
if ($modified_since !== FALSE) {
if ($modified_since === FALSE) {
return $return;
}
else {
if ($datastream->createdDate->getTimestamp() - $modified_since->getTimestamp() > 0) {
// Changed!
return $return;
@ -173,6 +176,10 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) {
}
if ($return === 200 && isset($_SERVER['HTTP_IF_UNMODIFIED_SINCE'])) {
$unmodified_since = DateTime::createFromFormat('D, d M Y H:i:s e', $_SERVER['HTTP_IF_UNMODIFIED_SINCE']);
if ($unmodified_since === FALSE) {
return $return;
}
else {
if ($datastream->createdDate->getTimestamp() !== $unmodified_since->getTimestamp()) {
// Changed!
$return = 412;
@ -181,6 +188,7 @@ function islandora_view_datastream_cache_check(AbstractDatastream $datastream) {
return $return;
}
}
}
// Only consider Etags we have provided.
if (isset($datastream->checksum)) {

Loading…
Cancel
Save