# HG changeset patch # User Heiko Schlittermann # Date 1451910315 -3600 # Node ID 17da316f1104a9e0d4b984fcd8d796dfe915c168 # Parent 171328219fef8c919374a2ce8fe5901a709f0c6c Use template for not-found diff -r 171328219fef -r 17da316f1104 bin/once --- a/bin/once Mon Jan 04 12:08:43 2016 +0100 +++ b/bin/once Mon Jan 04 13:25:15 2016 +0100 @@ -213,7 +213,7 @@ } $file{name} = $file; - $file{link} = "$ENV{PATH_INFO}/$dir$file"; + $file{link} = deslash "$ENV{PATH_INFO}/$dir$file"; $file{size} = humanize -s $_; $file{uploaded} = (stat _)[9]; $file{removal}{type} = $d; @@ -337,8 +337,12 @@ my $file = deslash realpath catfile $VAR, $+{path}; my $base = $+{base}; - unless (-f $file) { - print header('text/plain', '404 Not found'), 'Not found'; + if (not -f $file) { + my $tt = Template->new(\%TT_CONFIG) + or die $Template::ERROR; + my %tt = ( file => { name => $base }); + + $tt->process('not-found.html', \%tt) or die $tt->error(); exit 0; } diff -r 171328219fef -r 17da316f1104 templates/not-found.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/templates/not-found.html Mon Jan 04 13:25:15 2016 +0100 @@ -0,0 +1,4 @@ +[% WRAPPER once.tt %] +

Sorry

+Das File [% file.name %] existiert (nicht) mehr. +[% END %]