ficlatte / main

Ficlatté website main code
GNU Affero General Public License v3.0
2 stars 2 forks source link

Submitting story with errors causes 500 rather than error report #29

Closed ethel-t-frog closed 7 years ago

ethel-t-frog commented 7 years ago

If the user submits an over-length story, they will currently get a 505 instead of an error message and a request to submit a shorter story.

The error is being reported on line 822 of castle/views.py, which is the "render" call in the story sumbission error handler, and it is caused at line 55 of castle/templates/castle/edit_story.html.

Error is

ValueError: invalid literal for int() with base 10: ''

ethel-t-frog commented 7 years ago

Looks like this was introduced with the challenges feature, as line 55 of the template is where the challenge ID is added to the form.

stitzelj commented 7 years ago

Yup, I figured something slipped past me. I'll take a look here shortly and sort it out.

stitzelj commented 7 years ago

I just generated a PR that includes the commit with this bug fix. It didn't occur to me that an empty challenge id might wreak havoc with the error catching block of the submit_story view.

Let me know if you spot anything else.