feat(components): use original file name for raw images

This commit is contained in:
AlphaNecron 2021-10-23 12:27:59 +07:00
parent 6d8e4946f2
commit 324d605b9c
2 changed files with 2 additions and 1 deletions

View File

@ -69,6 +69,7 @@ const dev = process.env.NODE_ENV === 'development';
res.setHeader('Content-Type', mimetype);
}
res.setHeader('Content-Length', data.byteLength);
res.setHeader('Content-Disposition', `filename="${file.origFileName}"`);
res.end(data);
}
} else {

View File

@ -224,7 +224,7 @@ export const getServerSideProps: GetServerSideProps = async context => {
const res = await fetch(`${url}/${file.fileName}`);
if (!res.ok) return { notFound: true };
const content = await res.text();
const size = bytesToHr(res.headers.get('content-length'));
const size = bytesToHr(+res.headers.get('content-length'));
replace(size);
delete file.uploadedAt;
return {