Skip to content

HTTP 404 for "Browse Source" with shortened SHA hash #7562

Closed

Description

@rybak

Gogs version

c53b7e9

Git version

  • Server: N/A
  • Client: N/A

Operating system

N/A

Database

N/A

Describe the bug

URL https://try.gogs.io/gogs/gogs/src/c53b7e96 returns 404.

To reproduce

  1. Go to https://try.gogs.io/gogs/gogs/commit/c53b7e96
  2. Click on button "Browse Source"

Expected behavior

Same page as as "Browse Source" for full SHA hash – https://try.gogs.io/gogs/gogs/src/c53b7e9698524da9a2c80ab2c129ca4e623a25e9 – is opened.

Additional context

On GitHub, when a URL with shortened SHA is used, the links always use the full SHA hash. For example, the "Browse files" button on the page for the same commit: c53b7e96 (https://github.com/gogs/gogs/commit/c53b7e96) links to a /tree/ page with full SHA: https://github.com/gogs/gogs/tree/c53b7e9698524da9a2c80ab2c129ca4e623a25e9. However, shortened SHA hash also works for /tree/ pages. URL https://github.com/gogs/gogs/tree/c53b7e96 returns the same page.


I don't know how to check version of Gogs without access to /admin/ dashboard. I assumed the version used by try.gogs.io can be tied to commit c53b7e9 based on following HTML in the page:

<script src="/js/gogs.js?v=c53b7e9698524da9a2c80ab2c129ca4e623a25e9"></script>

Code of Conduct

  • I agree to follow this project's Code of Conduct

Activity

  1. added
    💊 bug
    on Oct 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    💊 bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions