Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion apps/api/src/config/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const APIKEY_RESTRICTION_REFERRER = "referrer";
export const APIKEY_RESTRICTION_IP = "ipaddress";
export const APIKEY_RESTRICTION_CUSTOM = "custom";
export const imagePattern = /^image\/(jpe?g|png)$/;
export const imagePatternIncludingGif = /^image\/(jpe?g|png|gif|webp)$/;
export const imagePatternForThumbnailGeneration = /^image\/(jpe?g|png|webp)$/;
export const videoPattern = /video/;
export const thumbnailWidth = 120;
export const thumbnailHeight = 69;
Expand Down
4 changes: 2 additions & 2 deletions apps/api/src/media/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
tempFileDirForUploads,
imagePattern,
videoPattern,
imagePatternIncludingGif,
imagePatternForThumbnailGeneration,
USE_CLOUDFRONT,
} from "../config/constants";
import imageUtils from "@medialit/images";
Expand Down Expand Up @@ -55,7 +55,7 @@ const generateAndUploadThumbnail = async ({
const thumbPath = `${workingDirectory}/thumb.webp`;

let isThumbGenerated = false; // to indicate if the thumbnail name is to be saved to the DB
if (imagePatternIncludingGif.test(mimetype)) {
if (imagePatternForThumbnailGeneration.test(mimetype)) {
await thumbnail.forImage(originalFilePath, thumbPath);
isThumbGenerated = true;
}
Expand Down
Loading