aboutsummaryrefslogtreecommitdiff
path: root/IkiWiki
diff options
context:
space:
mode:
authorJoey Hess <joeyh@joeyh.name>2018-10-28 18:57:45 -0400
committerJoey Hess <joeyh@joeyh.name>2018-10-28 19:00:32 -0400
commit0ec2c55ac097d28032fefe7f898db46b0eba305d (patch)
treea6febf52c713086e35e4f09e772554800b377db0 /IkiWiki
parent9332b8115daa2a0813cbc97dc7054576b063eab0 (diff)
downloadikiwiki-0ec2c55ac097d28032fefe7f898db46b0eba305d.tar
ikiwiki-0ec2c55ac097d28032fefe7f898db46b0eba305d.tar.gz
aggregate: Fix aggregation of posts without a title
When an aggregated post lacked a title, the code first prepended the $feed->{dir} to it, and only then checked if it had zero length. So, that check could never succeed and it was possible to end up with $page="dir/", and writing to that would of course fail. (Same problem could also occur when the whole title got sanitized away by the wiki_file_regexp.) Fixed by simply checking earlier if $page is empty. Based on a patch by Alexandre Oliva which got lost in a maze of email folders all alike for over two years despite him mentioning it to me at least once in person.
Diffstat (limited to 'IkiWiki')
-rw-r--r--IkiWiki/Plugin/aggregate.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index be7da3a71..05e22a290 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -621,11 +621,11 @@ sub add_page (@) {
# escape slashes and periods in title so it doesn't specify
# directory name or trigger ".." disallowing code.
$page=~s!([/.])!"__".ord($1)."__"!eg;
- $page=$feed->{dir}."/".$page;
- ($page)=$page=~/$config{wiki_file_regexp}/;
if (! defined $page || ! length $page) {
$page=$feed->{dir}."/item";
}
+ $page=$feed->{dir}."/".$page;
+ ($page)=$page=~/$config{wiki_file_regexp}/;
my $c="";
while (exists $IkiWiki::pagecase{lc $page.$c} ||
-e $IkiWiki::Plugin::transient::transientdir."/".htmlfn($page.$c) ||