--- 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;
}
--- /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 %]
+<h1>Sorry</h1>
+Das File <em>[% file.name %]</em> existiert (nicht) mehr.
+[% END %]