# User able to post exceeding maximum length restrictions

**URL:** https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983
**Category:** Bug
**Created:** [11 בספטמבר,‏ 2016,‏ 4:25pm UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983 "2016-09-11T16:25:18Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![jomaxro](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/jomaxro/32/126216_2.png) [@jomaxro](https://meta.discourse.org/u/jomaxro)
#### Post date: [11 בספטמבר,‏ 2016,‏ 4:25pm UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983/1 "2016-09-11T16:25:18Z")

</div>

Filing this as a bug, feel free to change to support if not the case.

Over at Stonehearth we had a user post a log directly as text in the editor, and was able to submit it. The post exceeds the maximum length allowed significantly, as I tried to edit the post to surround the log in a code block but was not allowed. The post in question was originally [here](http://discourse.stonehearth.net/t/stonehearth-crash-on-prepare-embrank/25438?u=jomaxro) and moved to [here](http://discourse.stonehearth.net/t/crash-on-prepare-to-embark/25439/6?u=jomaxro) where I converted it to a Pastebin link.

The error received stated:

```plaintext
Body is limited to 32000 characters; you entered 2459079.

```

If it helps troubleshoot, this post likely went through the approval queue as the user is new and we currently have the first 2 posts from each user go into the queue.

---

<div class="post-metadata">

### Author: ![cpradio](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/cpradio/32/4970_2.png) [@cpradio](https://meta.discourse.org/u/cpradio)
#### Post date: [11 בספטמבר,‏ 2016,‏ 4:39pm UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983/2 "2016-09-11T16:39:32Z")

</div>

Sounds similar to

> [@Reply to Closed Topic thanks to Needs Approval and Keyboard Shortcuts](https://meta.discourse.org/t/reply-to-closed-topic-thanks-to-needs-approval-and-keyboard-shortcuts/49887):
>
> Okay, so this is a fun scenario, and took me a while to work out. We had a Needs Approval post that was a reply to a topic that was closed in 2012! Colored with confusion, I’ve spent the last hour trying to figure out how to recreate it and I now have repo steps. Login as a new user, must be TL 0 Navigate to a closed Topic Press SHIFT + R to open the composer to enter a reply Quickly paste a paragraph of text and press CTRL + Enter to submit your reply You will be told that your post is pendi…

In the sense, that the Post Approval Queue isn’t validating the post before permitting it. Looks like another change in that area would need to be made so it abides by content length too.

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [11 בספטמבר,‏ 2016,‏ 6:20pm UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983/3 "2016-09-11T18:20:48Z")

</div>

This is a bug @eviltrout.

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [12 בספטמבר,‏ 2016,‏ 4:28pm UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983/4 "2016-09-12T16:28:14Z")

</div>

> [@cpradio](#):
>
> In the sense, that the Post Approval Queue isn’t validating the post before permitting it.

It’s honestly a little challenging to validate every little thing, due to the way the queue works. The (perhaps wrong) assumption I made when designing it was that the staff member had to approve it anyway, so the validation was less important.

Having said that, I did manage to get a bunch more validation in place, including the length:

[https://github.com/discourse/discourse/commit/2c9a47dda511a15efbf4ee4e92bee0b0f7b07def](https://github.com/discourse/discourse/commit/2c9a47dda511a15efbf4ee4e92bee0b0f7b07def)

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [12 בספטמבר,‏ 2016,‏ 10:57pm UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983/5 "2016-09-12T22:57:19Z")

</div>



---

<div class="post-metadata">

### Author: ![riking](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/riking/32/170938_2.png) [@riking](https://meta.discourse.org/u/riking)
#### Post date: [19 בספטמבר,‏ 2016,‏ 2:34am UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983/6 "2016-09-19T02:34:30Z")

</div>

Could you call into PostCreator with the ‘in transaction’ flag set, and always rollback, and only queue if PostCreator succeeded?

---

<div class="post-metadata">

### Author: ![eviltrout](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/eviltrout/32/5275_2.png) [@eviltrout](https://meta.discourse.org/u/eviltrout)
#### Post date: [19 בספטמבר,‏ 2016,‏ 2:43pm UTC](https://meta.discourse.org/t/user-able-to-post-exceeding-maximum-length-restrictions/49983/7 "2016-09-19T14:43:37Z")

</div>

Yes but that would be doing double the work in many cases, just for the sake of validating! The goal is to not build up a graph of extra queries.
