Large value for "title max word length" causes server error

  • Set title max word length to 2000000000
  • Try to create a topic
  • Get a 500 error
  • Topics cannot be created
RegexpError (too big number for repeat range: /\p{Alnum}{2000000001,}/)
lib/text_sentinel.rb:62:in `seems_unpretentious?'
lib/text_sentinel.rb:45:in `valid?'
lib/validators/quality_title_validator.rb:12:in `validate_each'
lib/topic_creator.rb:24:in `valid?'
lib/has_errors.rb:13:in `validate_child'
lib/post_creator.rb:133:in `valid?'
lib/post_creator.rb:187:in `create'
lib/new_post_manager.rb:318:in `perform_create_post'
lib/new_post_manager.rb:252:in `perform'
app/controllers/posts_controller.rb:215:in `create'

Introduced last week. Max is 100000.

2 Likes

Currently max topic title length seems to be capped at 255, so maybe title max word length should have that limit too?

I was thinking that one could remove the max word length limit on the title by setting it to 0 (instead of using a very high value), but that actually revealed a separate bug: it currently accepts 0 but that doesn’t disable the check, instead, it becomes impossible to create a topic since no title is valid:

It’s off course possible to revert the commit that surfaced this, but regardless of that, it seems that title max word length needs some validation (e.g. [1, 255])?

2 Likes

I had a go at this by limiting title_max_word_length to [1, 255].

1 Like

Since people might have been setting this to 0 in an attempt to disable the check, it might be better to migrate the value 0 to 255 instead of 1, what do you think? :thinking:

I don’t oppose it
 although I doubt there is any forum with this inadvertently set to 0 as no topics can be created at that point, so it would likely have been reverted already.

2 Likes

That’s true! Ignore my comment please !