Jump to Line Fragment Should Ignore Line Numbers < 1 #9804

Closed
opened 2025-11-02 08:50:04 -06:00 by GiteaMirror · 3 comments
Owner

Originally created by @r10r on GitHub (Nov 8, 2022).

Description

When calling https://codeberg.org/Codeberg/gitea/src/branch/codeberg-1.17/README.md?display=source#L0 it is internally redirected to https://codeberg.org/Codeberg/gitea/src/branch/codeberg-1.17/README.md?display=source#undefined
which leads to the following javascript error:

JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'length') (https://codeberg.org/assets/js/index.js?v=1.17.3~87-ge4b8341 @ 83:11976). Open browser console to see more details.

Maybe line numbers < 1 can simply be ignored as github does:

https://github.com/go-gitea/gitea/blob/main/README.md?plain=1#L0

This would fix issues with links from external systems that don't check the line number properly.

Gitea Version

1.17.3

Can you reproduce the bug on the Gitea demo site?

Yes

Log Gist

No response

Screenshots

No response

Git Version

No response

Operating System

No response

How are you running Gitea?

helm chart

Database

PostgreSQL

Originally created by @r10r on GitHub (Nov 8, 2022). ### Description When calling https://codeberg.org/Codeberg/gitea/src/branch/codeberg-1.17/README.md?display=source#L0 it is internally redirected to https://codeberg.org/Codeberg/gitea/src/branch/codeberg-1.17/README.md?display=source#undefined which leads to the following javascript error: >JavaScript error: Uncaught TypeError: Cannot read properties of undefined (reading 'length') (https://codeberg.org/assets/js/index.js?v=1.17.3~87-ge4b8341 @ 83:11976). Open browser console to see more details. Maybe line numbers < 1 can simply be ignored as github does: https://github.com/go-gitea/gitea/blob/main/README.md?plain=1#L0 This would fix issues with links from external systems that don't check the line number properly. ### Gitea Version 1.17.3 ### Can you reproduce the bug on the Gitea demo site? Yes ### Log Gist _No response_ ### Screenshots _No response_ ### Git Version _No response_ ### Operating System _No response_ ### How are you running Gitea? helm chart ### Database PostgreSQL
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 08:50:04 -06:00
Author
Owner

@silverwind commented on GitHub (Nov 8, 2022):

Reproduces on try.gitea.io as well:

https://try.gitea.io/silverwind/symlink-test/src/branch/master/test.txt#L0

Hitting the back button on the page produces more errors.

@silverwind commented on GitHub (Nov 8, 2022): Reproduces on try.gitea.io as well: https://try.gitea.io/silverwind/symlink-test/src/branch/master/test.txt#L0 Hitting the back button on the page produces more errors.
Author
Owner

@silverwind commented on GitHub (Nov 8, 2022):

https://github.com/go-gitea/gitea/pull/21728

@silverwind commented on GitHub (Nov 8, 2022): https://github.com/go-gitea/gitea/pull/21728
Author
Owner

@r10r commented on GitHub (Nov 8, 2022):

@silverwind Thanks for addressing this so quickly!

@r10r commented on GitHub (Nov 8, 2022): @silverwind Thanks for addressing this so quickly!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#9804