Skip to content

Silent error when upload size limit does not match server configuration #1671

@trichoplax

Description

@trichoplax

Describe the bug
Not a problem for Codidact in production, as the file upload limit is set to 2MB and works correctly, but if another instance of QPixel has the server configuration set to a value smaller than specified in the admin interface then the user will be given no error message, but files of sizes between the 2 different limits will silently fail. To a user who doesn't look in the developer window, it will look like the file is in the process of uploading, but it will never finish.

To Reproduce
At the time of raising this, the dev server has this mismatch, so you can see the lack of error message there.

Steps to reproduce the behavior:

  1. Go to the edit page for a new/existing post.
  2. Click on the file upload button.
  3. Select a file that is a little under 2MB.
  4. See no indication that anything is wrong.
  5. The developer console shows an error message Uncaught (in promise) SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data and the upload line in the Network tab shows a response of 413 Request Entity Too Large from nginx.

Expected behavior
If the response is not JSON there should be a message to the user indicating that the upload failed, and the ![Uploading, please wait...]() should be removed from the post body.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions