diff --git a/js/metadata.js b/js/metadata.js index afa8fcc5..3ec6a5df 100644 --- a/js/metadata.js +++ b/js/metadata.js @@ -24,7 +24,7 @@ function extractWaveMetadata(filePath) { const format = buffer.toString('utf-8', 8, 12); // Should be "WAVE" if (chunkId !== 'RIFF' || format !== 'WAVE') { - return reject(new Error('Invalid WAV file')); + return reject(new Error('Invalid WAV file: ', filePath)); } let currentOffset = 12; // Start after the RIFF header diff --git a/js/ui.js b/js/ui.js index 2cbb17b2..2e69a309 100644 --- a/js/ui.js +++ b/js/ui.js @@ -1015,9 +1015,15 @@ async function onOpenFiles(args) { showElement(['spectrogramWrapper'], false); resetResults({clearSummary: true, clearPagination: true, clearResults: true}); resetDiagnostics(); - // Store the file list and Load First audio file STATE.openFiles = sanitisedList; - STATE.openFiles.length > 1 && STATE.openFiles.length < 25_000 && worker.postMessage({action: 'check-all-files-saved', files: STATE.openFiles}); + // CHeck not more than 25k files + if (STATE.openFiles.length >= 25_000){ + generateToast({message: `Chirpity limits the maximum number of open files to 25,000. Only the first 25,000 of the ${STATE.openFiles.length} attempted will be opened`}) + STATE.openFiles.splice(25000) + } + // Store the file list and Load First audio file + + STATE.openFiles.length > 1 && worker.postMessage({action: 'check-all-files-saved', files: STATE.openFiles}); // Sort file by time created (the oldest first): if (STATE.openFiles.length > 1) {