diff options
author | Joey Hess <joey@kitenet.net> | 2010-07-18 16:28:39 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2010-07-18 16:28:39 -0400 |
commit | 773db5a35e5b81fee3f1f8bf48dffc1dd4f3e2fe (patch) | |
tree | 82a81b26153f174357a89ae67519151c0ea5372e /IkiWiki.pm | |
parent | 775fefeea72209cc4eae1bbe314bd94491bcb1b3 (diff) | |
download | ikiwiki-773db5a35e5b81fee3f1f8bf48dffc1dd4f3e2fe.tar ikiwiki-773db5a35e5b81fee3f1f8bf48dffc1dd4f3e2fe.tar.gz |
avoid error if two source files render the same destination file
There are two sub-caces. If both source files still exist, the winner that
renders the destination file is undefined. If one source file is deleted
and the other added, in a refresh, the new file will take over the
destination file.
Diffstat (limited to 'IkiWiki.pm')
-rw-r--r-- | IkiWiki.pm | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 701f7137d..4acc5508a 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -879,7 +879,19 @@ sub will_render ($$;$) { # Important security check. if (-e "$config{destdir}/$dest" && ! $config{rebuild} && ! grep { $_ eq $dest } (@{$renderedfiles{$page}}, @{$oldrenderedfiles{$page}}, @{$wikistate{editpage}{previews}})) { - error("$config{destdir}/$dest independently created, not overwriting with version from $page"); + my $from_other_page=0; + foreach my $p (keys %renderedfiles) { + if (grep { + $_ eq $dest || + dirname($_) eq $dest + } @{$renderedfiles{$p}}) { + $from_other_page=1; + last; + } + } + + error("$config{destdir}/$dest independently created, not overwriting with version from $page") + unless $from_other_page; } if (! $clear || $cleared{$page}) { |