[dancer-users] Why does send_file() require a path relative to pubdir?

David Precious davidp at preshweb.co.uk
Mon Mar 24 17:20:37 GMT 2014


On Mon, 24 Mar 2014 07:55:45 -0600
Warren Young <warren at etr-usa.com> wrote:

> Dancer::send_file() gives a "No such file" error if you pass it an 
> absolute path or one that is not directly relative to $pubdir.

Use the system_path info, as documented, to indicate you're providing
an absolute filesystem path.

It's done this way to ensure users don't accidentally expose sensitive
info from their systems.

e.g.:

send_file(
  "/home/me/app/pdfbuild/foo-$user-$yymmdd-$hhmmss.pdf",
  system_path => 1
);

(Obviously ensuring those vars are sane, and don't contain anything
nefarious.)



More information about the dancer-users mailing list