Refactor MIME type check in storage service
Replace loop-based MIME type check with Set.prototype.has for improved readability and performance. This change eliminates the need for an explicit loop, making the code more concise and efficient.
This commit is contained in:
parent
fcb39250ca
commit
56df921a9b
@ -58,8 +58,7 @@ export class StorageService {
|
||||
* @return {boolean} - True if the current MIME type is allowed, false otherwise.
|
||||
*/
|
||||
function checkMime(allowedMime: Set<string>, currentMime: string): boolean {
|
||||
for (const mime of allowedMime) if (mime === currentMime) return true;
|
||||
return false;
|
||||
return allowedMime.has(currentMime);
|
||||
}
|
||||
|
||||
const fileType = await FileType.fileTypeFromBuffer(file);
|
||||
|
Loading…
x
Reference in New Issue
Block a user