summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2009-03-27 13:44:31 -0400
committerJoey Hess <joey@gnu.kitenet.net>2009-03-27 13:44:31 -0400
commit260ee2a28368691a5f1a7dee918717a28d28ed2e (patch)
tree447c04cd89ed94323f04f3e2a55f53fd89756e89
parent10822a22b3d8872afb31e1847ee7448af86c574d (diff)
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.)
-rw-r--r--IkiWiki/Plugin/comments.pm9
1 files changed, 3 insertions, 6 deletions
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;