Fix location of head return call

This commit is contained in:
rijkvanzanten
2022-08-02 14:39:11 -04:00
parent 8085b0d788
commit 73d31b7c53

View File

@@ -154,14 +154,6 @@ router.get(
const { stream, file, stat } = await service.getAsset(id, transformation, range);
if (req.method.toLowerCase() === 'head') {
res.status(200);
res.setHeader('Accept-Ranges', 'bytes');
res.setHeader('Content-Length', stat.size);
return res.end();
}
const access = req.accountability?.role ? 'private' : 'public';
res.attachment(req.params.filename ?? file.filename_download);
@@ -187,6 +179,14 @@ router.get(
res.removeHeader('Content-Disposition');
}
if (req.method.toLowerCase() === 'head') {
res.status(200);
res.setHeader('Accept-Ranges', 'bytes');
res.setHeader('Content-Length', stat.size);
return res.end();
}
stream.on('data', (chunk) => res.write(chunk));
stream.on('end', () => {