Set filename for right-click & save-as behavior

This commit is contained in:
swaggboi 2023-08-24 20:28:38 -04:00
parent bb2ce292ed
commit 62c0b9213b
2 changed files with 14 additions and 0 deletions

View File

@ -11,6 +11,13 @@ sub by_id($self) {
$self->stash(status => 404, error => 'Remark not found 🤷')
unless keys %{$remark};
# Set filename for right-click & save-as behavior
if ($self->stash('format') eq 'txt') {
$self->res->headers->content_disposition(
"inline; filename=remark_${remark_id}.txt"
)
}
$self->render;
}

View File

@ -75,6 +75,13 @@ sub by_id($self) {
$self->stash(status => 404, error => 'Page not found 🕵️')
unless scalar @{$remarks} || $this_page == $last_page;
# Set filename for right-click & save-as behavior
if ($self->stash('format') eq 'txt') {
$self->res->headers->content_disposition(
"inline; filename=thread_${thread_id}.txt"
)
}
$self->render;
}