Skip to content

improved file input and error handling#120

Open
git-lakshy wants to merge 2 commits into
grame-cncm:masterfrom
git-lakshy:filehandlebetter
Open

improved file input and error handling#120
git-lakshy wants to merge 2 commits into
grame-cncm:masterfrom
git-lakshy:filehandlebetter

Conversation

@git-lakshy
Copy link
Copy Markdown
Contributor

@git-lakshy git-lakshy commented Feb 16, 2026

In this PR

File upload and editor drag&drop handlers used readAsText() for all files, reading binary audio data as text, File read errors were also silent. This PR changes audio file handling into a reusable utility, fixes binary file corruption, and adds proper error feedback.

Changes

  • New reusable utility src/audioFileUtils.ts

    • with AudioFile() (now case-insensitive regex check) and readFileContent() (now returns string for code, Uint8Array for audiofiles).
  • in FileManager.ts

    • Used src/audioFileUtils.ts to replace the inline regex checks with isAudioFile() and added Error Handling.
  • In index.ts

    • Fixed binary corruption for Drag&Drop and upload handler
    • Added error handling for both handlers
    • Export now inlcudes mp3, ogg and aac
    • Early return guard for cancelled upload
  • Some minor changes

    • Audio file regex check is now case insensitive
    • Added accept in index.html for better UX, user can still switch file picker to All files
    • Audio files no longer recompile

@git-lakshy git-lakshy marked this pull request as draft February 16, 2026 22:33
@git-lakshy git-lakshy marked this pull request as ready for review February 16, 2026 23:57
@git-lakshy
Copy link
Copy Markdown
Contributor Author

@sletz can you review this PR

@git-lakshy git-lakshy marked this pull request as draft February 22, 2026 15:23
@git-lakshy
Copy link
Copy Markdown
Contributor Author

Sorry I thought export failing with an audio file was because of this PR but it was present before this PR

image

Making the PR ready for review again

@git-lakshy git-lakshy marked this pull request as ready for review February 22, 2026 23:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant