Skip to content

--from misclassifies GitHub issue URLs as git repos #497

@ayskobtw-lil

Description

@ayskobtw-lil

Bug

The shared --from resolver treats any known forge URL with at least <owner>/<repo> path segments as a git repository. That means URLs like:

https://github.com/profullstack/sh1pt/issues/403
https://github.com/profullstack/sh1pt/tree/master/packages

are classified as kind: 'git'. The inferred name can become a subpath segment such as 403, and build --from may later try to git clone a non-cloneable issue/tree URL.

Repro

Call resolveInput('https://github.com/profullstack/sh1pt/issues/403').

Observed before the fix:

{ kind: 'git', inferredName: '403', value: 'https://github.com/profullstack/sh1pt/issues/403' }

Expected

Only forge repo-root URLs like https://github.com/profullstack/sh1pt should be classified as git repos. Forge issue, pull, tree, blob, and other subpath URLs should remain normal live URLs.

Proposed fix

Parse known forge URLs with URL and require exactly two path segments after the host for repo-root detection. Add regression tests for GitHub issue and tree URLs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions