Skip to content

Fix browse <path> URL on non-GitHub forges#96

Merged
andrew merged 1 commit into
mainfrom
fix-gitlab-blob-url
May 22, 2026
Merged

Fix browse <path> URL on non-GitHub forges#96
andrew merged 1 commit into
mainfrom
fix-gitlab-blob-url

Conversation

@andrew
Copy link
Copy Markdown
Contributor

@andrew andrew commented May 22, 2026

forge browse <path> hardcoded /blob/{branch}/{path}, which only works on GitHub. GitLab wants /-/blob/, Gitea/Forgejo want /src/branch/, and Bitbucket wants /src/.

Adds BlobURL(repoHTMLURL, ref, path) to RepoService following the URL-builder pattern from #91 and wires browse onto it.

The Gitea path assumes ref is a branch name. Tags and commit SHAs use /src/tag/ and /src/commit/ respectively, but -b is documented as a branch flag and disambiguating would need an extra API round-trip.

@andrew andrew merged commit d557457 into main May 22, 2026
7 checks passed
@andrew andrew deleted the fix-gitlab-blob-url branch May 22, 2026 17:51
@michaelblyons
Copy link
Copy Markdown

If you want to get carried away, I have a gratuitously long set of web URLs at https://github.com/rscherf/GitLink

@andrew
Copy link
Copy Markdown
Contributor Author

andrew commented May 22, 2026

@michaelblyons oh nice, yeah I don't see why not!

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.

2 participants