summaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-05-07 13:47:29 -0400
committerJoey Hess <joey@kitenet.net>2010-05-07 13:47:29 -0400
commit2dfdadf10cefea593508e85979a0dff8c1584f2f (patch)
tree1bc46f7f015d8f6d5c7d75cdf9c7290a3a1e4ed8 /IkiWiki
parent8d3c89f0c75c31c5e17a661150662e3efd3a146e (diff)
bugfix
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/comments.pm10
1 files changed, 4 insertions, 6 deletions
diff --git a/IkiWiki/Plugin/comments.pm b/IkiWiki/Plugin/comments.pm
index 93c8c4061..077c4776b 100644
--- a/IkiWiki/Plugin/comments.pm
+++ b/IkiWiki/Plugin/comments.pm
@@ -473,7 +473,7 @@ sub editcomment ($$) {
$postcomment=0;
if (! $ok) {
- $location=unique_comment_location($page, $content, $config{srcdir});
+ $location=unique_comment_location($page, $content, $config{srcdir}, "._comment_pending");
writefile("$location._comment_pending", $config{srcdir}, $content);
# Refresh so anything that deals with pending
@@ -858,22 +858,20 @@ sub num_comments ($$) {
return @comments;
}
-sub unique_comment_location ($$$) {
+sub unique_comment_location ($$$$) {
my $page=shift;
-
eval q{use Digest::MD5 'md5_hex'};
error($@) if $@;
my $content_md5=md5_hex(Encode::encode_utf8(shift));
-
my $dir=shift;
+ my $ext=shift || "._comment";
my $location;
my $i = num_comments($page, $dir);
do {
$i++;
$location = "$page/$config{comments_pagename}${i}_${content_md5}";
- } while (-e "$dir/$location._comment" ||
- -e "$dir/$location._comment_pending");
+ } while (-e "$dir/$location$ext");
return $location;
}