From 9776bbf8532d0a952e907c160dc31ce27c0d08e5 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Tue, 22 Jul 2008 17:12:20 -0400 Subject: [PATCH] Don't allow uploading an attachment with the same name as an existing page, to avoid confusion. --- IkiWiki/Plugin/attachment.pm | 6 ++++++ debian/changelog | 2 ++ 2 files changed, 8 insertions(+) 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}}) { diff --git a/debian/changelog b/debian/changelog index 8238ad625..57bf4a356 100644 --- a/debian/changelog +++ b/debian/changelog @@ -17,6 +17,8 @@ ikiwiki (2.55) UNRELEASED; urgency=low * Add allow_symlinks_before_srcdir config setting that can be used to avoid a security check that is a good safe default, but problimatic overkill in some situations. + * Don't allow uploading an attachment with the same name as an existing + page, to avoid confusion. -- Joey Hess Mon, 21 Jul 2008 11:35:46 -0400 -- 2.26.2