Browse Source

Can have non-defined DSs again.

pull/568/head
willtp87 10 years ago
parent
commit
f6523225a3
  1. 3
      includes/add_datastream.form.inc
  2. 2
      includes/mimetype.utils.inc

3
includes/add_datastream.form.inc

@ -149,7 +149,8 @@ function islandora_add_datastream_form_validate(array $form, array &$form_state)
$form_state['values']['dsid'] $form_state['values']['dsid']
); );
$file = file_load($form_state['values']['file']); $file = file_load($form_state['values']['file']);
if ($file) { // Only validate extensions if mimes defined in ds-composite.
if ($file && $extensions) {
$errors = file_validate_extensions($file, implode(' ', $extensions)); $errors = file_validate_extensions($file, implode(' ', $extensions));
if (count($errors) > 0) { if (count($errors) > 0) {
form_set_error( form_set_error(

2
includes/mimetype.utils.inc

@ -73,7 +73,7 @@ function islandora_get_extensions_for_mimetype($mimetype) {
function islandora_get_extensions_for_datastream(AbstractObject $object, $dsid) { function islandora_get_extensions_for_datastream(AbstractObject $object, $dsid) {
module_load_include('inc', 'islandora', 'includes/utilities'); module_load_include('inc', 'islandora', 'includes/utilities');
$datastream_mime_map = islandora_get_datastreams_requirements_from_models($object->models); $datastream_mime_map = islandora_get_datastreams_requirements_from_models($object->models);
$mimes = $datastream_mime_map[$dsid]['mime']; $mimes = isset($datastream_mime_map[$dsid]) ? $datastream_mime_map[$dsid]['mime'] : array();
if (isset($object[$dsid])) { if (isset($object[$dsid])) {
$current_mime = $object[$dsid]->mimetype; $current_mime = $object[$dsid]->mimetype;
if (!in_array($current_mime, $mimes)) { if (!in_array($current_mime, $mimes)) {

Loading…
Cancel
Save