Skip to content

Creating comment on a file with filename+path longer than 256 chars leads to 500 internal server error #33716

Open
@vladimirhasko

Description

@vladimirhasko

Description

We have some files which including path and file names are having more than 256 chars in length. After trying to create comment on such files we receive 500 internal server error:

500 Internal Server Error

An error occurred:

CreateCodeComment, pq: value too long for type character varying(255)

Gitea Version: 1.23.1

Is this soft or hard limit of gitea? Can it be adjusted to allow more characters?
On our postgresql we see that there's character limit including the comment table:

SELECT table_name, column_name, character_maximum_length
FROM information_schema.columns
WHERE table_schema = 'public'
AND character_maximum_length = 255;

---------------------------+-----------------------+--------------------------
        table_name         |      column_name      | character_maximum_length
---------------------------+-----------------------+--------------------------
...
 comment                   | old_title             |                      255
 comment                   | new_title             |                      255
 comment                   | old_ref               |                      255
 comment                   | new_ref               |                      255
 comment                   | tree_path             |                      255

Is tree_path parameter responsible for this issue? so comment cannot be created when the tree_path exceeds 255 characters?
Is this parameter adjustable or it can negatively impact the overall gitea functionality?
And if there are allowed files with longer filepath+filename length why commenting them leads to error? Shouldn't be this limit adjustable according to allowed length of filepath+filename?

PS: Issue cannot be reproduced on gitea demo site as the site is down.

Gitea Version

1.23.1

Can you reproduce the bug on the Gitea demo site?

No

Log Gist

No response

Screenshots

Image

Git Version

v2.34.1

Operating System

Ubuntu 22.04.3 LTS

How are you running Gitea?

We use one of your downloads for gitea binary (v1.23.1) and run it on our servers.
It's being run as systemd service

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