openid: in &openiduser, allow subdirectory-style providers to end with '/'

This improves the display of OpenIDs like 'http://id.mayfirst.org/jamie/'
(taking an example from the IkiWiki commit log).
master
Simon McVittie 2008-12-21 16:35:02 +00:00
parent e0cd19f30b
commit 801dc76bf0
1 changed files with 2 additions and 1 deletions

View File

@ -197,8 +197,9 @@ sub openiduser ($) {
$display=~s/^([-a-zA-Z0-9]+?)\.([-.a-zA-Z0-9]+\.[a-z]+)$/$1 [$2]/; $display=~s/^([-a-zA-Z0-9]+?)\.([-.a-zA-Z0-9]+\.[a-z]+)$/$1 [$2]/;
} }
# Convert "http://somehost.com/user" to "user [somehost.com]". # Convert "http://somehost.com/user" to "user [somehost.com]".
# (also "https://somehost.com/user/")
if ($display !~ /\[/) { if ($display !~ /\[/) {
$display=~s/^https?:\/\/(.+)\/([^\/]+)$/$2 [$1]/; $display=~s/^https?:\/\/(.+)\/([^\/]+)\/?$/$2 [$1]/;
} }
$display=~s!^https?://!!; # make sure this is removed $display=~s!^https?://!!; # make sure this is removed
eval q{use CGI 'escapeHTML'}; eval q{use CGI 'escapeHTML'};