mirror of
https://gitlab.com/wgp/dougal/software.git
synced 2025-12-06 10:57:07 +00:00
Allow direct downloading of sequence reports.
If the `download` or `d` query parameter is supplied (even without any value), the response will include a `Content-Disposition: attachment` header. A filename will also be suggested.
This commit is contained in:
@@ -13,6 +13,11 @@ const html = async function (req, res, next) {
|
||||
const template = templates[0].template;
|
||||
|
||||
const response = await render(seis, template);
|
||||
|
||||
if ("download" in query || "d" in query) {
|
||||
const filename = `${req.params.project}-seq${query.sequence.padStart(3, "0")}.html`;
|
||||
res.set("Content-Disposition", `attachment; filename="${filename}"`);
|
||||
}
|
||||
res.status(200).send(response);
|
||||
next();
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user