Skip to content

fix: support non-GitHub repositories in --force url parsing#211

Open
codxbrexx wants to merge 1 commit intometacall:masterfrom
codxbrexx:fix/non-github-repo
Open

fix: support non-GitHub repositories in --force url parsing#211
codxbrexx wants to merge 1 commit intometacall:masterfrom
codxbrexx:fix/non-github-repo

Conversation

@codxbrexx
Copy link
Contributor

Problem

This PR fixes a bug where the --force option crashes when passing non-GitHub repository URLs via --addrepo. It replaces the brittle, hardcoded split('com/') approach with native new URL() parsing to make suffix generation host-agnostic and robust against any valid repository URL (GitLab, self-hosted .local or .org, etc.).

Changes

  1. Refactored src/force.ts to use new URL() for parsing paths.
  2. Extracted URL extraction logic into the testable pure function getSuffixFromUrl.
  3. Created unit tests in src/test/force.spec.ts using Mocha to ensure any given URL is handled properly, and invalid URLs don't crash the deploy process.

Resolves

Resolves #210

Testing

image

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

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

1 participant