summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoey Hess <joey@kodama.kitenet.net>2008-07-01 13:39:02 -0400
committerJoey Hess <joey@kodama.kitenet.net>2008-07-01 13:39:02 -0400
commit5aee8d937d694dc5ae43b85c6d81ce9d268d1626 (patch)
treea5dd94066b4ed0162716fcc86fea69df38a91d4a
parenta78a981792e7420783f5064f52100635429922f1 (diff)
bugfixes
-rw-r--r--IkiWiki/Plugin/attachment.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index f9d7f14f6..d2989bb8b 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -32,7 +32,7 @@ sub formbuilder (@) { #{{{
if ($form->submitted eq "Upload") {
my $q=$params{cgi};
- my $filename=IkiWiki::basename($q->param('attachment'));
+ my $filename=$q->param('attachment');
if (! defined $filename || ! length $filename) {
# no file, so do nothing
return;
@@ -46,11 +46,11 @@ sub formbuilder (@) { #{{{
# to, unless that page is an "index" page.
my $page=$form->field('page');
$page=~s/(^|\/)index//;
- $filename="$page/$filename";
+ $filename=$page."/".IkiWiki::basename($filename);
# To untaint the filename, escape any hazardous characters,
# and make sure it isn't pruned.
- $filename=IkiWiki::titlepage(IkiWiki::possibly_foolish_untaint($filename);
+ $filename=IkiWiki::titlepage(IkiWiki::possibly_foolish_untaint($filename));
if (IkiWiki::file_pruned($filename, $config{srcdir})) {
error(gettext("bad attachment filename"));
}
@@ -71,7 +71,7 @@ sub formbuilder (@) { #{{{
# Move the attachment into place.
# Try to use a fast rename; fall back to copying.
- prep_writefile($filename, $config{srcdir});
+ IkiWiki::prep_writefile($filename, $config{srcdir});
unlink($config{srcdir}."/".$filename);
if (! rename($tempfile, $config{srcdir}."/".$filename)) {
my $fh=$q->upload('attachment');