summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-22 17:12:20 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-22 17:12:20 -0400
commit9776bbf8532d0a952e907c160dc31ce27c0d08e5 (patch)
tree4772a039099f5b48173f0117f56748b8cdf16cb6 /IkiWiki/Plugin
parent114e20e9485a97eeefffd07061db9a2290a541a4 (diff)
Don't allow uploading an attachment with the same name as an existing page, to avoid confusion.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/attachment.pm6
1 files changed, 6 insertions, 0 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index acc52f0e9..c6711aa05 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -16,6 +16,12 @@ sub check_canattach ($$;$) {
my $dest=shift; # where it's going to be put, under the srcdir
my $file=shift; # the path to the attachment currently
+ # Don't allow an attachment to be uploaded with the same name as an
+ # existing page.
+ if (exists $pagesources{$dest} && $pagesources{$dest} ne $dest) {
+ error(sprintf(gettext("there is already a page named %s"), $dest));
+ }
+
# Use a special pagespec to test that the attachment is valid.
my $allowed=1;
foreach my $admin (@{$config{adminuser}}) {