From 4ba420dce8affb7fbd9cf9c7bf84b363794b5878 Mon Sep 17 00:00:00 2001 From: jonathangreen Date: Tue, 20 Mar 2012 11:21:08 -0300 Subject: [PATCH] Updated Fedora Item Datastream add for HTTPS When a datastream is added using HTTPS if its using the drupal url it will try to use HTTP instead of HTTPS since Fedora has some problems with HTTP. Ammended commit. Removed debug statements. --- api/fedora_item.inc | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 1714c571..7e4810e5 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -136,10 +136,18 @@ class Fedora_Item { * @return type */ function add_datastream_from_url($datastream_url, $datastream_id, $datastream_label = NULL, $datastream_mimetype = '', $controlGroup = 'M', $logMessage = NULL) { + global $base_url; + if (empty($datastream_label)) { $datastream_label = $datastream_id; } + // Fedora has some problems getting files from HTTPS connections sometimes, so if we are getting a file + // from the local drupal, we try to pass a HTTP url instead of a HTTPS one. + if(stripos($datastream_url, 'https://') !== FALSE && stripos($datastream_url, $base_url) !== FALSE) { + $datastream_url = str_ireplace('https://', 'http://', $datastream_url); + } + $params = array( 'pid' => $this->pid, 'dsID' => $datastream_id,