summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin
diff options
context:
space:
mode:
authorJoey Hess <joey@kitenet.net>2010-06-16 13:23:32 -0400
committerJoey Hess <joey@kitenet.net>2010-06-16 13:23:32 -0400
commit69c22fa1ea143e3eb36692e087b167ae2171581e (patch)
tree5caea6f31f07b9a978046bf5dcd88373278070d0 /IkiWiki/Plugin
parent96c7e31c34b10e343afb3f17eb1ca7c34aaa4123 (diff)
attachment: Support Windows paths when taking basename of client-supplied file name.
Diffstat (limited to 'IkiWiki/Plugin')
-rw-r--r--IkiWiki/Plugin/attachment.pm5
1 files changed, 4 insertions, 1 deletions
diff --git a/IkiWiki/Plugin/attachment.pm b/IkiWiki/Plugin/attachment.pm
index 9c774557f..ce688ca40 100644
--- a/IkiWiki/Plugin/attachment.pm
+++ b/IkiWiki/Plugin/attachment.pm
@@ -134,9 +134,12 @@ sub formbuilder (@) {
}
}
+ $filename=IkiWiki::basename($filename);
+ $filename=~s/.*\\+(.+)/$1/; # hello, windows
+
$filename=linkpage(IkiWiki::possibly_foolish_untaint(
attachment_location($form->field('page')).
- IkiWiki::basename($filename)));
+ $filename));
if (IkiWiki::file_pruned($filename)) {
error(gettext("bad attachment filename"));
}