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

Closed
opened 2025-11-02 11:05:47 -06:00 by GiteaMirror · 0 comments
Owner

Originally created by @vladimirhasko on GitHub (Feb 25, 2025).

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

Originally created by @vladimirhasko on GitHub (Feb 25, 2025). ### 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](https://github.com/user-attachments/assets/17d65341-3589-403d-9b2f-c3616aaa2036) ### 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
GiteaMirror added the issue/confirmedtype/bug labels 2025-11-02 11:05:47 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/gitea#14188