From 7fdf1f1d007b5ef9a16f5c6d41200cadb25c1975 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 4 Jul 2010 16:44:38 -0400 Subject: [PATCH] move nickname sanitization out Probably best to store it unsanitized and sanitize as needed on use. And it already was for comments, leaving only the need to sanitize the nickname when git committing, to ensure the email address is legal. --- IkiWiki/Plugin/git.pm | 2 ++ IkiWiki/Plugin/openid.pm | 2 -- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/IkiWiki/Plugin/git.pm b/IkiWiki/Plugin/git.pm index 0f92476c9..cb3437e18 100644 --- a/IkiWiki/Plugin/git.pm +++ b/IkiWiki/Plugin/git.pm @@ -517,6 +517,8 @@ sub rcs_commit_staged (@) { } if (defined $params{session}->param("nickname")) { $u=encode_utf8($params{session}->param("nickname")); + $u=~s/\s+/_/g; + $u=~s/[^-_0-9[:alnum:]]+//g; } if (defined $u) { $ENV{GIT_AUTHOR_EMAIL}="$u\@web"; diff --git a/IkiWiki/Plugin/openid.pm b/IkiWiki/Plugin/openid.pm index 4727577f3..b1a9a7a15 100644 --- a/IkiWiki/Plugin/openid.pm +++ b/IkiWiki/Plugin/openid.pm @@ -211,8 +211,6 @@ sub auth ($$) { } } if (defined $nickname) { - $nickname=~s/\s+/_/g; - $nickname=~s/[^-_0-9[:alnum:]]+//g; $session->param(nickname => $nickname); } } -- 2.26.2