summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--IkiWiki.pm14
-rwxr-xr-xt/conflicts.t2
2 files changed, 14 insertions, 2 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}) {
diff --git a/t/conflicts.t b/t/conflicts.t
index ac270e806..81b2c12cb 100755
--- a/t/conflicts.t
+++ b/t/conflicts.t
@@ -2,7 +2,7 @@
# Tests for bugs relating to conflicting files in the srcdir
use warnings;
use strict;
-use Test::More tests => 48;
+use Test::More tests => 76;
# setup
my $srcdir="t/tmp/src";