flarum / framework

Simple forum software for building great communities.
http://flarum.org/
6.24k stars 828 forks source link

Content max limit is incorrect #3942

Closed vimar closed 4 months ago

vimar commented 7 months ago

Current Behavior

When trying to write a very long post, I have received the following message:

The content must not be greater than 65535 characters.

Steps to Reproduce

  1. Go to new discussion
  2. Write a very long text (more than 65535 characters)
  3. The message should appear

Expected Behavior

As content field is a MySQL mediumtext type, it should be able to handle more than 65535 characters (Mediumtext size is equal to 2^24 size)

Screenshots

No response

Environment

Output of php flarum info

Output of "php flarum info", run this in terminal in your Flarum directory.

Possible Solution

No response

Additional Context

No response

davwheat commented 7 months ago

Post content is encoded into an XML-like format using s9e/TextFormatter.

What you type on the front-end is not identical to what gets stored in the database.

As a result, we have opted to artificially limit the content length that can be submitted versus what the database can handle.

There's no way we can easily inform users about the limits (as 1 character from the user could cause 10 characters from TextFormatter), hence the artificial limit is a better solution.

luceos commented 4 months ago

Although @davwheat is correct. One could use the validation extender to increase the content limit for specific purposes, though your database needs to support this as well.

So even if there is a default limit, there is a way to override that with a extender.

Closing for this and the above reason.