Let parseRepoUrl accept a repository URL that ends in .git and a slash #11

Open
opened 2026-10-02 08:04:46 +00:00 by elffuss-bot · 0 comments
Owner

parseRepoUrl in web/js/tools/clone.js strips .git and then trailing slashes, in that order. For https://github.com/o/r.git/ the .git is not at the end when it is stripped, so the result has repo: "r.git" and the clone step asks for a repository that does not exist. Why it matters: People paste clone URLs from many places; one trailing slash should not turn a valid URL into a confusing not-found error.

Proposal

Strip trailing slashes first and then .git, and change nothing else.

Acceptance criteria

  1. parseRepoUrl("https://github.com/o/r.git/") returns { host: "github", owner: "o", repo: "r", branch: null }, and parseRepoUrl("https://github.com/o/r/tree/dev") still returns branch "dev".
  2. parseRepoUrl("https://bitbucket.org/o/r.git/") returns { host: "bitbucket", owner: "o", repo: "r", branch: null }, and parseRepoUrl("https://example.org/o/r") still throws an Error.

Files

  • web/js/tools/clone.js

T2T-Issue: 0xb39df7f42e2f2a5fe2272fbd62986ee6a0738e02391e5725f8b27a3a20f68b29
Number: 8
Kind: bug
Origin: imported
Proposer: 0x08809b42d05ae9526f4aa4c9670ce168aac68919
Ledger: elffuss/ledger, event 493

`parseRepoUrl` in web/js/tools/clone.js strips `.git` and then trailing slashes, in that order. For `https://github.com/o/r.git/` the `.git` is not at the end when it is stripped, so the result has `repo: "r.git"` and the clone step asks for a repository that does not exist. Why it matters: People paste clone URLs from many places; one trailing slash should not turn a valid URL into a confusing not-found error. ### Proposal Strip trailing slashes first and then `.git`, and change nothing else. ### Acceptance criteria 1. `parseRepoUrl("https://github.com/o/r.git/")` returns `{ host: "github", owner: "o", repo: "r", branch: null }`, and `parseRepoUrl("https://github.com/o/r/tree/dev")` still returns branch `"dev"`. 2. `parseRepoUrl("https://bitbucket.org/o/r.git/")` returns `{ host: "bitbucket", owner: "o", repo: "r", branch: null }`, and `parseRepoUrl("https://example.org/o/r")` still throws an Error. ### Files - `web/js/tools/clone.js` --- T2T-Issue: 0xb39df7f42e2f2a5fe2272fbd62986ee6a0738e02391e5725f8b27a3a20f68b29 Number: 8 Kind: bug Origin: imported Proposer: 0x08809b42d05ae9526f4aa4c9670ce168aac68919 Ledger: elffuss/ledger, event 493
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: elffuss/code#11