Index: link.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/link/link.module,v retrieving revision 1.25.2.3 diff -u -p -r1.25.2.3 link.module --- link.module 18 Oct 2010 03:46:47 -0000 1.25.2.3 +++ link.module 26 Nov 2010 02:22:43 -0000 @@ -403,9 +403,32 @@ function _link_load($field, &$item) { } function _link_process(&$item, $delta = 0, $field, $entity) { + global $base_url, $base_secure_url, $base_insecure_url; + // Trim whitespace from URL. $item['url'] = trim($item['url']); + // Store system paths. + // Work out the correct base_path to use based on the HTTPS settings. + if (variable_get('https', FALSE)) { + $base_url = $base_secure_url; + } + elseif (!empty($base_insecure_url) && $base_insecure_url != $base_url) + $base_url = $base_insecure_url; + } + // Strip the system $base_url and the base_path(). + $raw_path = str_replace($base_url . base_path(), '', $item['url']); + $normal_path = drupal_get_normal_path($raw_url); + if ($item['url'] != $normal_path) { + $item['url'] = $normal_path; + } + else { + $normal_path = drupal_get_normal_path($item['url']); + if ($item['url'] != $normal_path) { + $item['url'] = $normal_path; + } + } + // if no attributes are set then make sure $item['attributes'] is an empty array - this lets $field['attributes'] override it. if (empty($item['attributes'])) { $item['attributes'] = array();