From 4da98f08c2a7fea82d9ed15369fad5ddd0fe6b6b Mon Sep 17 00:00:00 2001 From: willtp87 Date: Tue, 27 Nov 2012 11:41:58 -0400 Subject: [PATCH] ISLANDORA-779 Not hitting Fedora after a datastream ingest. --- api/fedora_item.inc | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index eb4c3e66..ae524fd9 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -175,12 +175,13 @@ class Fedora_Item { if (stripos($datastream_url, 'https://') !== FALSE && stripos($datastream_url, $base_url) !== FALSE) { $datastream_url = str_ireplace('https://', 'http://', $datastream_url); } + $datastream_label = truncate_utf8($datastream_label, 255, TRUE, TRUE); $params = array( 'pid' => $this->pid, 'dsID' => $datastream_id, 'altIDs' => NULL, - 'dsLabel' => truncate_utf8($datastream_label, 255, TRUE, TRUE), + 'dsLabel' => $datastream_label, 'versionable' => TRUE, 'MIMEType' => $datastream_mimetype, 'formatURI' => NULL, @@ -193,8 +194,14 @@ class Fedora_Item { ); $soap_result = $this->soap_call('addDataStream', $params); - // Make sure to refresh the datastream list after adding so this item stays in sync with the repository. - $this->datastreams = $this->get_datastreams_list_as_array(); + + // Add new DS to the DS list so the item is in sync with the repository. + $this->datastreams[$datastream_id] = array( + 'label' => $datastream_label, + 'MIMEType' => $datastream_mimetype, + 'URL' => ($this->url() . '/' . $datastream_id . '/' . + drupal_urlencode($datastream_label)),); + return $soap_result; }