Skip to content

Commit c813e76

Browse files
committed
refactor(web): update-message-creator-function
1 parent 19908c6 commit c813e76

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

web/src/utils/index.ts

+8-1
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,12 @@ export const getFileUploaderMsg = (role: Roles, roleRestrictions?: Role[]) => {
2727

2828
if (!restrictions) return;
2929

30-
return `Allowed file types: [${restrictions.restriction.allowedMimeTypes.map((type) => type.split("/")?.[1] ?? null).join(", ")}], Max allowed size: ${(restrictions.restriction.maxSize / (1024 * 1024)).toFixed(2)} MB.`;
30+
return `Allowed file types: [ ${restrictions.restriction.allowedMimeTypes
31+
.map((type) => {
32+
const [prefix, suffix] = type.split("/");
33+
if (!suffix) return prefix ?? null;
34+
35+
return suffix === "*" ? prefix : suffix;
36+
})
37+
.join(", ")} ], Max allowed size: ${(restrictions.restriction.maxSize / (1024 * 1024)).toFixed(2)} MB.`;
3138
};

0 commit comments

Comments
 (0)