diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-11-20 12:55:57 -0500 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-11-20 12:55:57 -0500 |
commit | dca6c835fe2e97331751e1cdedf1dbf0009309ef (patch) | |
tree | 663cba89e12d9f7cc7d48c52e79b4f384bbe4059 | |
parent | 17659599f3ea76c3c2e88de625e40265a20a93d7 (diff) | |
download | ikiwiki-dca6c835fe2e97331751e1cdedf1dbf0009309ef.tar ikiwiki-dca6c835fe2e97331751e1cdedf1dbf0009309ef.tar.gz |
avoid adding ./ to urls unnecessarily
This avoids constructing urls like "./../foo/".
The leading "../" avoids any colon confusion already.
I noticed in my logs that certain badly written web spiders (hello again,
Yahoo!) fail to follow urls like ikiwiki was constructing to the right
place (instead ending up at "./foo/")
-rw-r--r-- | IkiWiki.pm | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 735dc97b1..17e2a2a85 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -942,9 +942,9 @@ sub beautify_urlpath ($) { #{{{ $url =~ s!/index.$config{htmlext}$!/!; } - # Ensure url is not an empty link, and - # if it's relative, make that explicit to avoid colon confusion. - if ($url !~ /^\//) { + # Ensure url is not an empty link, and if necessary, + # add ./ to avoid colon confusion. + if ($url !~ /^\// && $url !~ /^\.\.\//) { $url="./$url"; } |