FU: Add "denied" and "notfound" convenience methods
This commit is contained in:
parent
b06cc24826
commit
3662931fc2
2 changed files with 16 additions and 6 deletions
|
|
@ -79,7 +79,7 @@ my @tabs = (
|
|||
tr_ sub {
|
||||
td_ $_;
|
||||
td_ $r->{reshdr}{$_};
|
||||
} for keys $r->{reshdr}->%*;
|
||||
} for sort keys $r->{reshdr}->%*;
|
||||
};
|
||||
('Response')
|
||||
},
|
||||
|
|
@ -308,7 +308,7 @@ sub listing_ {
|
|||
}
|
||||
|
||||
sub load($id) {
|
||||
open my $fn, '<', "$FU::debug_info->{storage}/fu-$id.txt" or fu->error(404);
|
||||
open my $fn, '<', "$FU::debug_info->{storage}/fu-$id.txt" or fu->notfound;
|
||||
scalar <$fn>;
|
||||
local $/=undef;
|
||||
fu->set_body(scalar <$fn>);
|
||||
|
|
@ -322,12 +322,12 @@ sub render {
|
|||
fu->set_body(framework_ collect);
|
||||
} elsif ($q eq 'last') {
|
||||
my $lst = listing;
|
||||
fu->error(404) if !@$lst;
|
||||
fu->notfound if !@$lst;
|
||||
load $lst->[$#$lst];
|
||||
} elsif ($FU::debug_info->{storage} && $q =~ /^[0-9a-f]{22}$/) {
|
||||
load $q;
|
||||
} else {
|
||||
fu->error(404);
|
||||
fu->notfound
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue