From 4945479b9eabd378c9584f06831c0a1f3bb39dea Mon Sep 17 00:00:00 2001 From: Alan Stanley Date: Sat, 17 Sep 2011 10:22:35 -0300 Subject: [PATCH] Added file validity check to function add_datastream_from_file --- api/fedora_item.inc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 836e5b53..13f126aa 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -76,6 +76,11 @@ class Fedora_Item { */ function add_datastream_from_file($datastream_file, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) { module_load_include('inc', 'fedora_repository', 'MimeClass'); + if (!is_file($datastream_file)){ + drupal_set_message("$datastream_file not found
", 'warning'); + return; + + } if (empty($datastream_mimetype)) { // Get mime type from the file extension. $mimetype_helper = new MimeClass();