fix: support slash-based branch names in GitHub URLs and multi-dot file extensions#2212
Conversation
🦋 Changeset detectedLatest commit: af091cc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This pull request was closed.
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.



Description
This PR resolves two validation and parsing issues under issue #1940:
validation.service.ts):Replaces the greedy regular-expression-based parsing of remote GitHub blob URLs in
convertGitHubWebUrl()with a direct, robust conversion toraw.githubusercontent.com. This natively supports branches with slashes (e.g.feature/new-validation), tags, and commit SHAs without any local string-splitting or extra API roundtrips.SpecificationFile.ts):Updates
fileExists()to retrieve the file extension using.pop()instead of[1]. This ensures multi-dot files likemy.asyncapi.yamlare correctly classified, and extension-less files are handled gracefully instead of throwing runtime exceptions.SpecificationFile.ts):Isolates the try-catch block in
fileExists()to ONLY thelstatcall, preventing the masking of'invalid file'errors.Added the required changeset file under
.changeset/for patch version bumping.Fixes #1940
Fixes #2125
Verification
convertGitHubWebUrl()validating branch names with slashes, tags, and commit SHAs.fileExists()using temporary directories.npm run unit:test(68/68 unit tests passed cleanly).npm run lint(0 lint errors).npm run build(Build completed successfully).