]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
make urlabs a noop if base url is not provided
authorJoey Hess <joey@kitenet.net>
Wed, 5 Jan 2011 20:23:05 +0000 (16:23 -0400)
committerJoey Hess <joey@kitenet.net>
Wed, 5 Jan 2011 20:23:05 +0000 (16:23 -0400)
This allows urlabs($foo, $config{url}) to be used safely, even if
no url is configured.

IkiWiki.pm

index ef8ccb2da51e4b763418344237280cf563011fba..35e64d81568f6c98aedf18af682c77836310fc8b 100644 (file)
@@ -1072,6 +1072,8 @@ sub urlabs ($$) {
        my $url=shift;
        my $urlbase=shift;
 
+       return $url unless defined $urlbase && length $urlbase;
+
        eval q{use URI};
        URI->new_abs($url, $urlbase)->as_string;
 }