MCPcopy Create free account
hub / github.com/ScattrdBlade/bigFileUpload / isFileTypeAllowed

Function isFileTypeAllowed

utils/upload.ts:1296–1305  ·  view source on GitHub ↗
(file: File)

Source from the content-addressed store, hash-verified

1294}
1295
1296export function isFileTypeAllowed(file: File): boolean {
1297 const allowed = getAllowedExtensions();
1298 if (!allowed) return true;
1299
1300 const dotIndex = file.name.lastIndexOf(".");
1301 if (dotIndex < 1 || dotIndex === file.name.length - 1) return false;
1302
1303 const ext = file.name.slice(dotIndex + 1).toLowerCase();
1304 return allowed.has(ext);
1305}
1306
1307function getFilenameExtension(filename: string): string | undefined {
1308 const dotIndex = filename.lastIndexOf(".");

Callers 7

interceptUploadAddFilesFunction · 0.90
handlePasteFunction · 0.90
handleFileDropFunction · 0.90
channelAttachMenuPatchFunction · 0.90
uploadPickedFileFunction · 0.85
uploadProvidedFilesFunction · 0.85

Calls 1

getAllowedExtensionsFunction · 0.85

Tested by

no test coverage detected