From 87972d4a1a15a8790049b72895ab5874e5a30d2d Mon Sep 17 00:00:00 2001 From: Adam Vessey Date: Thu, 5 Jul 2012 10:10:25 -0400 Subject: [PATCH] ISLANDORA-695 Fix replace datastream errors. ... Looks like I had created had an error in my fix, so this should fix the error from the previous fix... Should be good now. --- api/fedora_item.inc | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/api/fedora_item.inc b/api/fedora_item.inc index 92c06c3f..cdfdc210 100644 --- a/api/fedora_item.inc +++ b/api/fedora_item.inc @@ -1013,25 +1013,34 @@ RDF; if ($parsed_url && array_key_exists('scheme', $parsed_url) && in_array($parsed_url['scheme'], $supported_schemes)) { $components = explode('/', $parsed_url['path']); $components = array_map('rawurlencode', $components); - $result = drupal_http_request( - url( - t('!scheme://!user:!pass@!host:!port/!path', array( + $fixed_url = url( + t( + '!scheme://!user:!pass@!host:!port/!path', + array( '!scheme' => $parsed_url['scheme'], '!user' => rawurlencode($parsed_url['user']), '!pass' => rawurlencode($parsed_url['pass']), '!host' => $parsed_url['host'], + '!port' => $parsed_url['port'], '!path' => implode('/', $components), - )), - array( - 'query' => $parsed_url['query'], - 'fragment' => $parsed_url['fragment'], ) + ), + array( + 'query' => $parsed_url['query'], + 'fragment' => $parsed_url['fragment'], ) ); + $result = drupal_http_request($fixed_url); if ((int)($result->code / 100) === 2) { $content = $result->data; } + else { + watchdog('fedora_repository', 'Failed making HTTP request to @URL. Info: @info', array( + '@URL' => $fixed_url, + '@info' => print_r($result, TRUE), + ), 'warning'); + } } return $content;