From: Joey Hess Date: Fri, 7 May 2010 17:47:29 +0000 (-0400) Subject: bugfix X-Git-Tag: 3.20100515~68 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=2dfdadf10cefea593508e85979a0dff8c1584f2f;p=ikiwiki.git bugfix --- 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; }