Browse Source

added a check to verify strrpos actually returned something useful before trying to call substr

pull/6/head^2
ppound 14 years ago
parent
commit
6d78e5f161
  1. 7
      fedora_repository.module

7
fedora_repository.module

@ -522,10 +522,13 @@ function fedora_repository_replace_stream_form_submit($form, &$form_state) {
$file = $form_state['values']['file'];
$pid = $form_state['values']['pid'];
$dsid = $form_state['values']['dsId'];
$dsLabel = $form_state['values']['dsLabel'];
// Remove the original file extension from the label and add the new one
$dsLabel = substr($form_state['values']['dsLabel'], 0, strrpos($form_state['values']['dsLabel'], '.'));
$indexOfDot = strrpos($dsLabel,'.');//use strrpos to get the last dot
if($indexOfDot !== FALSE){
$dsLabel = substr($dsLabel, 0, $indexOfDot);
$dsLabel .= substr($file->filename, strrpos($file->filename, '.')); // Add the file extention to the end of the label.;
}
module_load_include('inc', 'Fedora_Repository', 'MimeClass');
module_load_include('inc', 'Fedora_Repository', 'ObjectHelper');
module_load_include('inc', 'Fedora_Repository', 'ConnectionHelper');

Loading…
Cancel
Save