Fix a bug with links to pages whose names contained colons.

So the problem is that ikiwiki would generate a relative link like
href="colon:problem", which web browsers treat as being in the "colon:"
uri scheme.

The best fix seems to be to make url beautification fix this, by slapping
a "./" in front.
master
Joey Hess 2008-07-08 10:03:55 -04:00
parent 42dcf37016
commit e25c3a0a7c
2 changed files with 7 additions and 1 deletions

View File

@ -538,7 +538,12 @@ sub beautify_url ($) { #{{{
if ($config{usedirs}) { if ($config{usedirs}) {
$url =~ s!/index.$config{htmlext}$!/!; $url =~ s!/index.$config{htmlext}$!/!;
} }
$url =~ s!^$!./!; # Browsers don't like empty links...
# Ensure url is not an empty link, and
# if it's relative, make that explicit to avoid colon confusion.
if ($url !~ /\//) {
$url="./$url";
}
return $url; return $url;
} #}}} } #}}}

1
debian/changelog vendored
View File

@ -4,6 +4,7 @@ ikiwiki (2.53) UNRELEASED; urgency=low
(Gabriel McManus) (Gabriel McManus)
* attachment: Fix an uninitialised value warning when editing a page * attachment: Fix an uninitialised value warning when editing a page
that currently has no attachments. that currently has no attachments.
* Fix a bug with links to pages whose names contained colons.
-- Joey Hess <joeyh@debian.org> Mon, 07 Jul 2008 01:52:48 -0400 -- Joey Hess <joeyh@debian.org> Mon, 07 Jul 2008 01:52:48 -0400