From 260ee2a28368691a5f1a7dee918717a28d28ed2e Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 27 Mar 2009 13:44:31 -0400 Subject: use md5sum for page_to_id The munged ids were looking pretty nasty, and were not completly guaranteed to be unique. So a md5sum seems like a better approach. (Would have used sha1, but md5 is in perl core.) --- IkiWiki/Plugin/comments.pm | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'IkiWiki') diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm index 2ad422f5f..98f9f8b3d 100644 --- a/IkiWiki/Plugin/comments.pm +++ b/IkiWiki/Plugin/comments.pm @@ -819,13 +819,10 @@ sub page_to_id ($) { # comment. my $page=shift; - # It needs to start with a letter. - $page="comment_".$page; - - # Encode any illegal characters. - $page=~s/([^A-Za-z0-9-_:.])/"__".ord($1)."__"/eg; + eval q{use Digest::MD5 'md5_hex'}; + error($@) if $@; - return $page; + return "comment-".md5_hex($page); } package IkiWiki::PageSpec; -- cgit v1.2.3