Skip to content

Commit

Permalink
nits
Browse files Browse the repository at this point in the history
  • Loading branch information
ledyba committed Nov 11, 2024
1 parent 8e4f226 commit 91c21b0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions server/src/controller/both/EntityController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,19 +39,19 @@ export default class EntityController {
let ext;
switch(entity.mimeType) {
case 'image/jpeg':
ext = 'jpeg';
ext = '.jpeg';
break;
case 'image/png':
ext = 'png';
ext = '.png';
break;
case 'image/gif':
ext = 'gif';
ext = '.gif';
break;
case 'video/mp4':
ext = 'mp4';
ext = '.mp4';
break;
case 'audio/x-flac':
ext = 'flac';
ext = '.flac';
default:
return reply
.code(500)
Expand All @@ -64,7 +64,7 @@ export default class EntityController {
return reply
.code(200)
.type(entity.mimeType)
.header("content-disposition", `attachment; filename=\"${id+".original."+ext}\"`)
.header("content-disposition", `attachment; filename=\"${id+".original"+ext}\"`)
.sendFile(relativePath, basePath);
case 'medium': {
const meta = await fileTypeFromFile(path.join(basePath, relativePath));
Expand All @@ -77,14 +77,14 @@ export default class EntityController {
return reply
.code(200)
.type(meta.mime)
.header("content-disposition", `attachment; filename=\"${id+".medium."+ext}\"`)
.header("content-disposition", `attachment; filename=\"${id+".medium"+ext}\"`)
.sendFile(relativePath, basePath);
}
case 'icon':
return reply
.code(200)
.type('image/jpeg')
.header("content-disposition", `attachment; filename=\"${id+".icon."+ext}\"`)
.header("content-disposition", `attachment; filename=\"${id+".icon"+ext}\"`)
.sendFile(relativePath, basePath);
default:
return reply
Expand Down

0 comments on commit 91c21b0

Please sign in to comment.