]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/CGI.pm
deal with http:// part
[git.ikiwiki.info.git] / IkiWiki / CGI.pm
index 7f84f345a23e153074f3ff8b9c9db52c39871dd7..d23cf5d02236e059255e1f72e292e5ccee11ab2f 100644 (file)
@@ -634,6 +634,7 @@ sub cgi (;$$) { #{{{
        }
        elsif ($do eq 'blog') {
                my $page=titlepage(decode_utf8($q->param('title')));
+               $page=~s/(\/)/"__".ord($1)."__"/eg; # escape slashes too
                # if the page already exists, munge it to be unique
                my $from=$q->param('from');
                my $add="";
@@ -665,6 +666,10 @@ sub userlink ($) { #{{{
                if ($display !~ /\[/) {
                        $display=~s/^(.*?)\.([^.]+\.[a-z]+)$/$1 [$2]/;
                }
+               # Convert "http://somehost.com/user" to "user [somehost.com]".
+               if ($display !~ /\[/) {
+                       $display=~s/^https?:\/\/(.+)\/[^\/](.+)$/$2 [$1]/;
+               }
                $display=~s!^https?://!!; # make sure this is removed
                return "<a href=\"$user\">".escapeHTML($display)."</a>";
        }