# HG changeset patch # User Nathan Phillip Brink # Date 2012-03-28 11:10:15 # Node ID 1cf1f641a5e5e20f3cd0ee872b853242ce794804 # Parent 1c87613b625caf2f79f65782519e7d759a17aa80 Make school_crawl_url() actually function properly for relative URIs. diff --git a/inc/school.crawl.inc b/inc/school.crawl.inc --- a/inc/school.crawl.inc +++ b/inc/school.crawl.inc @@ -586,12 +586,15 @@ function school_crawl_url($orig_url, $ur * qualified URL. It falls back to the original URL if it fails to * match. */ - foreach (array($url, $orig_url) as $aurl) + foreach (array($orig_url, $url) as $aurl) if (preg_match(';^(https?)://([^/]+)(/.*)$;', $aurl, $matches)) { - $new_url['schema'] = $matches[1]; - $new_url['hostname'] = $matches[2]; - $new_url['path'] = $matches[3]; + if (!empty($matches[1])) + $new_url['schema'] = $matches[1]; + if (!empty($matches[2])) + $new_url['hostname'] = $matches[2]; + if (!empty($matches[3])) + $new_url['path'] = $matches[3]; } /* check if we have an absolute relative path */