From 9d9c4844be96b7ae8ce78287951118f1af2c05aa Mon Sep 17 00:00:00 2001 From: Christopher Baines Date: Tue, 24 Jun 2014 16:02:26 +0100 Subject: Make ignoring symlinks configurable --- IkiWiki.pm | 9 ++++++++- IkiWiki/Render.pm | 3 ++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/IkiWiki.pm b/IkiWiki.pm index efb48293a..809d31f75 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -544,6 +544,13 @@ sub getsetup () { safe => 0, rebuild => 0, }, + allow_symlinks => { + type => "boolean", + default => 0, + description => "allow symlinks in the repository", + safe => 0, + rebuild => 0, + }, cookiejar => { type => "string", default => { file => "$ENV{HOME}/.ikiwiki/cookies" }, @@ -999,7 +1006,7 @@ sub readfile ($;$$) { my $binary=shift; my $wantfd=shift; - if (-l $file) { + if (!$config{allow_symlinks} and -l $file) { error("cannot read a symlink ($file)"); } diff --git a/IkiWiki/Render.pm b/IkiWiki/Render.pm index e8ed627a4..dbc07d817 100644 --- a/IkiWiki/Render.pm +++ b/IkiWiki/Render.pm @@ -320,7 +320,8 @@ sub find_src_files (;$$$) { my $helper=sub { my $file=decode_utf8($_); - return if -l $file || -d _; + return if -d $file; + return if !$config{allow_symlinks} and -l $file; $file=~s/^\.\///; return if ! length $file; $page = pagename($file); -- cgit v1.2.3