Skip to content

Bug: --force crashes with non-GitHub repo URLs, (GitLab, self-hosted,etc). #210

@codxbrexx

Description

@codxbrexx

What's happening

The --addrepo flag accepts any valid URL, but the suffix-parsing logic inside src/force.ts does a hardcoded split('com/'),
which only works for GitHub-style URLs. Any other host (gitlab.com group paths, .org, .io, self-hosted) can result in undefined,
causing a crash before deletion even runs.

Steps to reproduce

metacall-deploy --addrepo=https://gitlab.com/mygroup/myrepo --force

What you'd expect

Suffix generation works for any valid repo URL.

What actually happens

split('com/')[1] returns undefined and the next .split('/') throws.

The fix

Parse the URL properly using new URL() (already used elsewhere in index.ts) to extract the pathname, strip the leading slash, and replace all remaining slashes with dashes to generate the suffix.

This is host-agnostic and consistent with how the rest of the codebase handles URLs.
Happy to open a PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions