Skip to content

Commit 07375b9

Browse files
authored
Merge pull request #156 from codelitdev:rajat1saxena/issue153
Uploading a gif file crashes the server
2 parents 35a4591 + 861f06a commit 07375b9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

apps/api/src/config/constants.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export const APIKEY_RESTRICTION_REFERRER = "referrer";
2626
export const APIKEY_RESTRICTION_IP = "ipaddress";
2727
export const APIKEY_RESTRICTION_CUSTOM = "custom";
2828
export const imagePattern = /^image\/(jpe?g|png)$/;
29-
export const imagePatternIncludingGif = /^image\/(jpe?g|png|gif|webp)$/;
29+
export const imagePatternForThumbnailGeneration = /^image\/(jpe?g|png|webp)$/;
3030
export const videoPattern = /video/;
3131
export const thumbnailWidth = 120;
3232
export const thumbnailHeight = 69;

apps/api/src/media/service.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
tempFileDirForUploads,
66
imagePattern,
77
videoPattern,
8-
imagePatternIncludingGif,
8+
imagePatternForThumbnailGeneration,
99
USE_CLOUDFRONT,
1010
} from "../config/constants";
1111
import imageUtils from "@medialit/images";
@@ -55,7 +55,7 @@ const generateAndUploadThumbnail = async ({
5555
const thumbPath = `${workingDirectory}/thumb.webp`;
5656

5757
let isThumbGenerated = false; // to indicate if the thumbnail name is to be saved to the DB
58-
if (imagePatternIncludingGif.test(mimetype)) {
58+
if (imagePatternForThumbnailGeneration.test(mimetype)) {
5959
await thumbnail.forImage(originalFilePath, thumbPath);
6060
isThumbGenerated = true;
6161
}

0 commit comments

Comments
 (0)