Bugfix for trying to attach files to a subpage of the index page.
[ikiwiki.git] / IkiWiki / Plugin / attachment.pm
index 4d6dee23e75a2fe4e1f76889b53b19e68483c001..52bac7c1e937ba87e2711ff41319e13a5cfd7814 100644 (file)
@@ -303,8 +303,8 @@ sub attachment_location ($) {
        my $page=shift;
        
        # Put the attachment in a subdir of the page it's attached
-       # to, unless that page is an "index" page.
-       $page=~s/(^|\/)index//;
+       # to, unless that page is the "index" page.
+       return "" if $page eq 'index';
        $page.="/" if length $page;
        
        return $page;