Fix inconsistent file extension handling in workspaces#1899
Open
Fix inconsistent file extension handling in workspaces#1899
Conversation
Extracted file extension matching and replacement logic into reusable utility functions (`doesFilenameMatchExtension` and `replaceFileExtension`) to improve code consistency and maintainability. Changes: - Added `doesFilenameMatchExtension()` utility to standardize extension checking - Added `replaceFileExtension()` utility to handle filename extension replacement - Replaced inline extension matching logic across ImportWorkspaceFileModal, SequenceEditor, and effects - Added error handling for file conversion operations - Simplified filename manipulation in sequence editor download functionality This refactoring reduces code duplication and provides a single source of truth for file extension operations throughout the workspace handling code.
…ensions Replace regex-based pattern matching with simple string comparison in `doesFilenameMatchExtension` and `replaceFileExtension` functions to avoid unintended behavior with special characters. Changes: - Use `endsWith()` instead of regex for extension matching - Add support for compound extensions (e.g., 'seqn.txt') - Use string slicing instead of regex replacement - Add validation check before replacing extension - Remove tests for regex special character handling - Add tests for compound extension scenarios This prevents issues where special regex characters in extensions (like `*`, `+`, `.`) would be interpreted as patterns rather than literal strings, making extension matching more predictable and correct.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addressing two issues reported by @parkerabercrombie -
test.SEQ.jsonI don’t get the option to translate to seqN, but if it’s calledtest.seq.jsonI do (case sensitivity)test.seqn.txtand download as SeqJSON I get a file called test.seqn.seq.json - should betest.seq.jsonVerification
To test upload issue:
To test download issue:
Outputbutton above the SequenceEditor