Skip to content

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

Description

@akashcorex

Describe the bug.

The CLI has two validation bugs causing valid inputs to fail.

1. GitHub URL Parsing

  • Regex assumes branch names do not contain /
  • Fails for valid URLs like:
https://github.com/org/repo/blob/feature/new-validation/spec.yaml
  • Incorrect parsing leads to 404 errors

2. File Extension Detection

  • Uses name.split('.')
  • Fails for:
my.asyncapi.yaml
asyncapi

Expected Behavior

All valid GitHub URLs and specification files should be accepted.

Actual Behavior

Valid inputs are rejected or cause runtime failures.

Expected behavior

Expected behavior

The CLI should correctly accept and process:

  • GitHub file URLs from any valid branch, including branches with slashes (e.g. feature/new-validation)
  • Specification files with multiple dots in the filename (e.g. my.asyncapi.yaml)
  • Filenames without extensions without crashing or behaving unpredictably

Valid inputs should not be rejected during validation.

Screenshots

Screenshots

N/A — this is a validation and parsing logic issue. The failure occurs during URL parsing and file validation, not in the UI.

How to Reproduce

How to reproduce

  1. Run the CLI with a GitHub file URL from a branch containing a slash, for example:
    https://github.com/org/repo/blob/feature/new-validation/spec.yaml
  2. Observe that the CLI fails due to incorrect branch parsing and returns a 404 error.
  3. Run the CLI with a specification file named:
    my.asyncapi.yaml
  4. Observe that the file is rejected due to incorrect extension detection.

🖥️ Device Information [optional]

  • Operating System (OS):
  • Browser:
  • Browser Version:

👀 Have you checked for similar open issues?

  • I checked and didn't find similar issue

🏢 Have you read the Contributing Guidelines?

Are you willing to work on this issue ?

None

Activity

  1. github-actions commented on Dec 28, 2025

    @github-actions
    Contributor

    Welcome to AsyncAPI. Thanks a lot for reporting your first issue. Please check out our contributors guide and the instructions about a basic recommended setup useful for opening a pull request.
    Keep in mind there are also other channels you can use to interact with AsyncAPI community. For more details check out this issue.

  2. Varadraj75 commented on Jan 3, 2026

    @Varadraj75
    Contributor

    Hey @Shurtu-gal @Souvikns @AayushSaini101 ,
    is this issue has been solved or can i work on it?

  3. ASHISH74888 commented on Jan 15, 2026

    @ASHISH74888

    Hii @derberg @princerajpoot20 @Shurtu-gal ,
    Is the issue still open? If so, I’d like to take it up.

  4. l8888888 commented on Apr 21, 2026

    @l8888888

    I've submitted a PR to fix both bugs mentioned in this issue: #2128

    The PR addresses:

    1. ✅ GitHub URL parsing for branch names with slashes (e.g., feature/new-validation)
    2. ✅ File extension detection for multi-dot filenames (e.g., my.asyncapi.yaml)

    Both issues are now resolved. Please review when you have a chance!

  5. BossChaos commented on Apr 22, 2026

    @BossChaos

    I'd like to work on this bug fix.

    Plan:

    1. Fix GitHub URL parsing regex to support branch names with slashes (e.g., feature/new-validation)
    2. Fix file extension detection to handle multi-dot filenames (e.g., my.asyncapi.yaml)
    3. Add test cases for both scenarios

    ETA: Within 24 hours

    Will submit PR once complete.

  6. BossChaos commented on Apr 22, 2026

    @BossChaos

    ✅ Implementation Complete

    I've submitted PR #2131 to fix this issue.

    Changes:

    1. Bug Fix: Updated regex pattern in validation.service.ts to support slash-based branch names (e.g., feature/new-validation)
    2. Test Coverage: Added test case to validate the fix

    Commits:

    • 881ecda - fix: Support slash-based branches and multi-dot spec files
    • e68e935 - test: Add test case for slash-based branch names

    The PR is ready for review. Thanks! 🙏

  7. BossChaos commented on Apr 22, 2026

    @BossChaos

    Update

    PR #2131 was submitted as duplicate of #2128. Closing in favor of #2128 by @l8888888.

    Thanks!

  8. added 2 commits that reference this issue on Apr 22, 2026
    3fc8606
    1ac5021
  9. zanabalofficial commented on Apr 22, 2026

    @zanabalofficial

    Hi! I'd like to work on this bug fix for GitHub URL parsing and file extension detection. I can fix both issues: (1) update the regex to handle branch names with slashes, and (2) improve file extension detection for multi-dot filenames. Let me know if this is still available!

  10. BossChaos commented on Apr 22, 2026

    @BossChaos

    Hi @akashcorex, thanks for reporting this issue!

    I'd like to work on fixing both bugs:

    1. GitHub URL parsing for slash-based branch names
    2. File extension detection for multi-dot filenames

    I'll start investigating the root cause and submit a PR soon. If anyone else is already working on this, please let me know to avoid duplicate efforts.


    你好 @akashcorex,感谢报告这个问题!

    我想负责修复这两个 bug:

    1. 带斜杠分支名的 GitHub URL 解析问题
    2. 多点文件名的扩展名检测问题

    我会开始调查根本原因并尽快提交 PR。如果其他人已经在处理这个问题,请告诉我以避免重复工作。

  11. 3 remaining items

  12. bobbiejaxn commented on May 7, 2026

    @bobbiejaxn

    I have submitted PR #2187 to fix this issue.

    Approach:

    • GitHub URL parsing: Replaced regex with string-based parsing that correctly handles branch names containing slashes (e.g., feature/new-validation). Uses raw.githubusercontent.com for simpler, more reliable file resolution.
    • File extension detection: Replaced name.split('.')[1] with path.extname() which correctly handles multi-dot filenames (e.g., my.asyncapi.yaml → .yaml).
    • Test coverage: Added comprehensive tests for both fixes including edge cases.

    All CI checks pass (SonarCloud clean, automerge approved). The changes are minimal and focused — 3 files changed, no unnecessary refactoring.

    Would appreciate a review from the maintainers. 🙏

  13. chengyixu commented on May 12, 2026

    @chengyixu

    /attempt #1940

  14. added 3 commits that reference this issue on May 12, 2026
    5668055
    e0d11c0
    f1b2a4d
  15. wdnmdtonyma commented on May 13, 2026

    @wdnmdtonyma

    I've submitted a fix for this issue in PR #2203. The PR addresses both bugs described here:

    1. GitHub URL parsing: Converted to using raw.githubusercontent.com URLs which natively resolve the branch/path ambiguity, correctly handling branches with slashes like feature/new-validation.

    2. File extension detection: Changed from name.split('.')[1] to parts.pop() to correctly extract the last extension segment, fixing multi-dot filenames like my.asyncapi.yaml and gracefully handling files without extensions.

    Happy to iterate based on review feedback.

  16. hikali123456789 commented on May 21, 2026

    @hikali123456789

    I have submitted PR #2208 which fixes the multi-dot filename extension bug in fileExists(). Please add bounty label and /claim. Thank you!

  17. tdnguyenND commented on May 22, 2026

    @tdnguyenND

    Hi, I've submitted a fix for both bugs in this issue: #2209

    A note on Bug 1 (slash-based branch names): several existing PRs change ([^\/]+) to (.+?) (lazy match), but lazy still resolves to the shortest segment — same broken behaviour for branches like feature/my-fix. The correct fix requires trying every possible branch/path split and retrying on 404.

    My PR replaces the single-URL conversion with generateGitHubApiCandidates that produces all splits ordered shortest-branch-first, then retries only on HTTP 404 (non-404 errors propagate immediately). Bug 2 is fixed with path.extname() as in other PRs.

  18. Ojas2095 commented on May 28, 2026

    @Ojas2095

    I would like to work on this issue under the MICROGRANT program. I have analyzed the bug and am ready to submit a PR.

  19. q404365631 commented on Jun 3, 2026

    @q404365631

    I'd like to take this on! I'll fix both sub-issues:

    1. The GitHub URL regex should accept slashes in branch names (e.g. feature/new-validation)
    2. The file extension detection should use proper path parsing, not just name.split(".")

    Will submit a PR shortly with tests.

  20. AayushSaini101 commented on Jun 7, 2026

    @AayushSaini101
    Collaborator

    closed via: #2216 thanks

  21. moved this from To Triage to Done in CLI - Kanbanon Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions