Skip to content
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

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

Closed
r10r opened this issue Nov 8, 2022 · 3 comments · Fixed by #21728
Closed

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

r10r opened this issue Nov 8, 2022 · 3 comments · Fixed by #21728
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug

Comments

@r10r
Copy link

r10r commented 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

@r10r r10r added the type/bug label Nov 8, 2022
@silverwind silverwind added the issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented label Nov 8, 2022
@silverwind
Copy link
Member

silverwind commented 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
Copy link
Member

#21728

@r10r
Copy link
Author

r10r commented Nov 8, 2022

@silverwind Thanks for addressing this so quickly!

silverwind added a commit to silverwind/gitea that referenced this issue Nov 8, 2022
lunny added a commit that referenced this issue Nov 11, 2022
Fixes: #21722

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
silverwind added a commit to silverwind/gitea that referenced this issue Nov 11, 2022
Fixes: go-gitea#21722

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
silverwind added a commit to silverwind/gitea that referenced this issue Nov 11, 2022
Fixes: go-gitea#21722

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
lunny added a commit that referenced this issue Nov 11, 2022
Backport #21728
Fixes: #21722

Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
@go-gitea go-gitea locked and limited conversation to collaborators May 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
issue/confirmed Issue has been reviewed and confirmed to be present or accepted to be implemented type/bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants