« Finding all the collections a DSPACE item belongs to | Main | DSPACE mime types for AgEcon ... Very few excel »

Islandora was not properly pointing at https fedora sites

The issue

When we changed to https for stage we got the white screen of death with drupal.

Location of code

The file where the troubled code is:
sites/all/modules/Islandora-islandora-6589c7c/ConnectionHelper.inc
function _fixURL

The bug

This is the basic problem. The code below will yield:
$new_url = 'http'
No matter what the input is.
<?php                   
   $url = 'https://ddd';
    if (strpos($url, 'http://') == 0) {
        $new_url = 'http';
    }
    elseif (strpos($url, 'https://') == 0) {
      $new_url = 'https';
    }
    else {
        drupal_set_message(t('Invalid URL: !url', array('!url' => $url)));
        return NULL;
    }
   echo $new_url . "\n";
?>
Rewrite of the code that properly selects https:
<?php                   
   $url = 'https://ddd';

    $url_start = substr ($url , 0, 5 );

    if ($url_start == 'http:') {
        $new_url = 'http';
    }
    elseif ($url_start == 'https') {
      $new_url = 'https';
    }
    else {
        drupal_set_message(t('Invalid URL: !url', array('!url' => $url)));
        return NULL;
    }
   echo $new_url . "\n";
?>
I inserted this code into the function _fixURL code of the file:
sites/all/modules/Islandora-islandora-6589c7c/ConnectionHelper.inc
and all is well.

Post a comment

(If you haven't left a comment here before, you may need to be approved by the site owner before your comment will appear. Until then, it won't appear on the entry. Thanks for waiting.)