Skip to content

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

Closed
@r10r

Description

@r10r

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    issue/confirmedIssue has been reviewed and confirmed to be present or accepted to be implementedtype/bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions