Skip to content

Commit

Permalink
fix: thumbnail path & upload size
Browse files Browse the repository at this point in the history
  • Loading branch information
7sete7 committed Jul 16, 2024
1 parent 746d522 commit 16f3723
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/server/routes/rest/file/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async function imageApiFn(
const getImagePath = () => {
const maxDimension = Math.max(parseInt(width, 10), parseInt(height, 10));
if (maxDimension <= thumbnailSize) {
return path.join(document, recordId, fieldName, 'thumbnail', fileName);
return path.join(document, recordId, fieldName, 'thumbnail', fileName).replace(/\.jpeg$/, '') + '.jpeg';
}
if (preprocess != null) {
return path.join(document, recordId, fieldName, 'watermark', fileName);
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/rest/file/sendFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export async function sendFile(filePath: string, reply: FastifyReply) {
Bucket: MetaObject.Namespace.storage.bucket,
Key: filePath,
},
result: s3Result,
result: s3Result.$metadata,
},
`Proxying file ${filePath} from S3`,
);
Expand Down
2 changes: 1 addition & 1 deletion src/server/routes/rest/file/upload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ const fileUploadApi: FastifyPluginCallback = (fastify, _, done) => {
.resize({
width: MetaObject.Namespace.storage?.thumbnail?.size ?? DEFAULT_THUMBNAIL_SIZE,
height: MetaObject.Namespace.storage?.thumbnail?.size ?? DEFAULT_THUMBNAIL_SIZE,
fit: 'inside',
fit: 'cover',
})
.jpeg({
quality: MetaObject.Namespace.storage?.jpeg?.quality ?? DEFAULT_JPEG_QUALITY,
Expand Down

0 comments on commit 16f3723

Please sign in to comment.