Skip to content

fix: github URL parsing for slash-based branches and multi-dot filenames#2137

Open
BossChaos wants to merge 2 commits intoasyncapi:masterfrom
BossChaos:fix/url-parsing-and-extension-detection-1940
Open

fix: github URL parsing for slash-based branches and multi-dot filenames#2137
BossChaos wants to merge 2 commits intoasyncapi:masterfrom
BossChaos:fix/url-parsing-and-extension-detection-1940

Conversation

@BossChaos
Copy link
Copy Markdown

Summary

Fixes Issue #1940 - Two validation bugs causing valid inputs to fail.

Changes

1. GitHub URL Parsing (validation.service.ts)

  • Before: Regex ([^\/]+) assumed branch names contain no slashes
  • After: Regex (.+?) supports branch names with slashes (e.g., feature/new-validation)

2. File Extension Detection (SpecificationFile.ts)

  • Before: name.split(".")[1] failed for multi-dot filenames
  • After: path.extname(name).slice(1) correctly handles my.asyncapi.yaml

Testing

Tested with:

  • GitHub URLs with slash-based branches: https://github.com/org/repo/blob/feature/new-validation/spec.yaml
  • Multi-dot filenames: my.asyncapi.yaml
  • Files without extensions

Related

Fixes #1940

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 22, 2026

🦋 Changeset detected

Latest commit: 6e57522

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@asyncapi/cli Patch

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

BossChaos and others added 2 commits April 22, 2026 18:03
- Update GitHub blob URL regex to support branch names with slashes
- Use path.extname() instead of split('.') for reliable file extension detection
- Fix Issue asyncapi#1940

Co-authored-by: Adma 機械人 <adma@hermes.agent>
@BossChaos BossChaos force-pushed the fix/url-parsing-and-extension-detection-1940 branch from b1d34d8 to 6e57522 Compare April 22, 2026 10:06
@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Failed Quality Gate failed

Failed conditions
1 Security Hotspot

See analysis details on SonarQube Cloud

@BossChaos BossChaos changed the title fix: GitHub URL parsing for slash-based branches and multi-dot filenames fix: github URL parsing for slash-based branches and multi-dot filenames Apr 22, 2026
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