Rework blob endpoint to match the standard convention #10819

Closed
opened 2025-11-02 09:19:01 -06:00 by GiteaMirror · 4 comments
Owner

Originally created by @shalak on GitHub (May 9, 2023).

Feature Description

This is a follow up for https://github.com/go-gitea/gitea/issues/4048 and https://github.com/go-gitea/gitea/pull/5334

The above introduced following blob support via URL:

https://gitea.mydomain.com/username/reponame/src/commit/<SHA>/path/to/file.c#L49

While the standard is:

https://gitea.mydomain.com/username/reponame/blob/<SHA>/path/to/file.c#L49

Basically simple path rewrite from /:user/:repo/blob/ to /:user/:repo/src/commit/ would do the trick. That way, plugins like copy-git-link would work out of the box.

Screenshots

No response

Originally created by @shalak on GitHub (May 9, 2023). ### Feature Description This is a follow up for https://github.com/go-gitea/gitea/issues/4048 and https://github.com/go-gitea/gitea/pull/5334 The above introduced following blob support via URL: ``` https://gitea.mydomain.com/username/reponame/src/commit/<SHA>/path/to/file.c#L49 ``` While the standard is: ``` https://gitea.mydomain.com/username/reponame/blob/<SHA>/path/to/file.c#L49 ``` Basically simple path rewrite from `/:user/:repo/blob/` to `/:user/:repo/src/commit/` would do the trick. That way, plugins like [copy-git-link](https://github.com/kawamataryo/copy-git-link) would work out of the box. ### Screenshots _No response_
GiteaMirror added the type/proposaltype/feature labels 2025-11-02 09:19:01 -06:00
Author
Owner

@lunny commented on GitHub (May 10, 2023):

I think Gitea supports https://gitea.mydomain.com/username/reponame/raw/blob/<SHA>/path/to/file.c#L49

@lunny commented on GitHub (May 10, 2023): I think Gitea supports `https://gitea.mydomain.com/username/reponame/raw/blob/<SHA>/path/to/file.c#L49`
Author
Owner

@shalak commented on GitHub (May 10, 2023):

I think Gitea supports https://gitea.mydomain.com/username/reponame/raw/blob/<SHA>/path/to/file.c#L49

Doesn't seem to. When I navigate to raw/blob/<SHA> I get redirected to a raw/branch/master/blob/<SHA> which is a 404 page.

@shalak commented on GitHub (May 10, 2023): > I think Gitea supports `https://gitea.mydomain.com/username/reponame/raw/blob/<SHA>/path/to/file.c#L49` Doesn't seem to. When I navigate to `raw/blob/<SHA>` I get redirected to a `raw/branch/master/blob/<SHA>` which is a 404 page.
Author
Owner

@wxiaoguang commented on GitHub (Mar 14, 2025):

-> Improve repo commit view #33877

@wxiaoguang commented on GitHub (Mar 14, 2025): -> Improve repo commit view #33877
Author
Owner

@lunny commented on GitHub (Aug 18, 2025):

I think Gitea supports https://gitea.mydomain.com/username/reponame/raw/blob/<SHA>/path/to/file.c#L49

Doesn't seem to. When I navigate to raw/blob/<SHA> I get redirected to a raw/branch/master/blob/<SHA> which is a 404 page.

I can visit 825ac37736/src/attributes/classes.js (L11) and no redirect to other url

@lunny commented on GitHub (Aug 18, 2025): > > I think Gitea supports `https://gitea.mydomain.com/username/reponame/raw/blob/<SHA>/path/to/file.c#L49` > > Doesn't seem to. When I navigate to `raw/blob/<SHA>` I get redirected to a `raw/branch/master/blob/<SHA>` which is a 404 page. I can visit https://github.com/jquery/jquery/blob/825ac3773694e0cd23ee74895fd5aeb535b27da4/src/attributes/classes.js#L11 and no redirect to other url
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#10819