Skip to content

Commit 71999f5

Browse files
committed
fix(attachemnts): Fix img ext
1 parent 6fb2fdd commit 71999f5

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/minio/minio.service.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,12 @@ export class MinioService {
156156
const uuid = generateId(length);
157157
// Get the original filename to extract the proper extension
158158
const originalFilename = getOriginalFileName(filename);
159+
const extIndex = originalFilename.lastIndexOf('.');
160+
if (extIndex === -1) {
161+
return uuid;
162+
}
159163
const ext: string = originalFilename.substring(
160-
originalFilename.lastIndexOf('.'),
164+
extIndex,
161165
originalFilename.length,
162166
);
163167
return `${uuid}${ext}`;

0 commit comments

Comments
 (0)