Skip to content

Rework blob endpoint to match the standard convention #24623

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
shalak opened this issue May 9, 2023 · 3 comments · Fixed by #33877
Closed

Rework blob endpoint to match the standard convention #24623

shalak opened this issue May 9, 2023 · 3 comments · Fixed by #33877
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.

Comments

@shalak
Copy link

shalak commented May 9, 2023

Feature Description

This is a follow up for #4048 and #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

@shalak shalak added type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first. labels May 9, 2023
@shalak shalak changed the title Rework blog endpoint to match the standard convention Rework blob endpoint to match the standard convention May 10, 2023
@lunny
Copy link
Member

lunny commented May 10, 2023

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

@shalak
Copy link
Author

shalak commented 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.

@wxiaoguang
Copy link
Contributor

-> Improve repo commit view #33877

wxiaoguang added a commit that referenced this issue Mar 14, 2025
Fix #24623

Major changes:

1. Redirect `/owner/repo/blob/*` requests to `/owner/repo/src/commit/*`
(like GitHub)
2. Add a "view file diff" link (see screenshot below)
3. Refactor "AssertHTMLElement" to generic, now we can accurately assert
existence or number.
4. Add more tests

---------

Co-authored-by: silverwind <[email protected]>
Co-authored-by: delvh <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type/feature Completely new functionality. Can only be merged if feature freeze is not active. type/proposal The new feature has not been accepted yet but needs to be discussed first.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants