diff --git a/fedora_repository.module b/fedora_repository.module index 818fc4ac..62cc48a7 100644 --- a/fedora_repository.module +++ b/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');