Skip to content

fix(cli): correct GitHub URL branch parsing and file extension detection#2221

Open
messiawrq-design wants to merge 1 commit into
asyncapi:masterfrom
messiawrq-design:fix-github-url-and-ext-parsing
Open

fix(cli): correct GitHub URL branch parsing and file extension detection#2221
messiawrq-design wants to merge 1 commit into
asyncapi:masterfrom
messiawrq-design:fix-github-url-and-ext-parsing

Conversation

@messiawrq-design
Copy link
Copy Markdown

Fixes #1940.

Bug fixes included:

  1. GitHub URL Branch Parsing: Updated githubWebPattern in validation.service.ts from ([^\/]+) to (.+?) for the branch capture group. This correctly allows URLs with slash-based branch names (e.g., feature/new-validation) to be parsed instead of throwing a 404.
  2. File Extension Extraction: Updated the hardcoded name.split('.')[1] extraction in SpecificationFile.ts to intelligently use the last element of the split array (parts[parts.length - 1]). This gracefully handles multi-dot filenames like my.asyncapi.yaml and single-word files.

Bounty Wallet: 6sF8p22Gg83NKTJ6dvya7Srv4USCniZnP47DwQwK7Mtp (Solana) / Algora

Fixes asyncapi#1940.
1. Updated `githubWebPattern` in `validation.service.ts` from `([^\/]+)` to `(.+?)` for the branch capture group. This correctly allows URLs with slash-based branch names (e.g., `feature/new-validation`) to be parsed instead of throwing a 404.
2. Updated extension extraction in `SpecificationFile.ts` to use the last element of the split array (`parts[parts.length - 1]`), which gracefully supports multi-dot filenames like `my.asyncapi.yaml` and files with no extensions.

Bounty Wallet: 6sF8p22Gg83NKTJ6dvya7Srv4USCniZnP47DwQwK7Mtp (Solana) / Algora
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented May 30, 2026

⚠️ No Changeset found

Latest commit: b6f7248

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot
B Maintainability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: To Triage

Development

Successfully merging this pull request may close these issues.

[BUG] CLI fails for GitHub URLs with slash-based branches and multi-dot spec files

1 participant