Browse Source

Fix warning when the datastream label was shorter than the extension.

pull/449/head
Adam Vessey 11 years ago
parent
commit
4df5398b71
  1. 7
      includes/datastream.inc

7
includes/datastream.inc

@ -56,9 +56,12 @@ function islandora_view_datastream(AbstractDatastream $datastream, $download = F
$extension = '.' . $mime_detect->getExtension($datastream->mimetype);
// Prevent adding on a duplicate extension.
$label = $datastream->label;
$extension_length = strlen($extension);
$duplicate_extension_position = strripos($datastream->label, $extension, -$extension_length);
$filename = $datastream->label;
$duplicate_extension_position = strlen($label) > $extension_length ?
strripos($label, $extension, -$extension_length) :
FALSE;
$filename = $label;
if ($duplicate_extension_position === FALSE) {
$filename .= $extension;
}

Loading…
Cancel
Save