Browse Source

Merge pull request #449 from adam-vessey/7.x-FLVC-30

Fix warning when the datastream label was shorter than the extension.
pull/452/head
William Panting 11 years ago
parent
commit
824f0ebb4d
  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