#3983 (The Uploads insert dialog doesn't close after uploading)
by Luc Saffre · in Developers · assigned to Luc Saffre
Summary
Children
Comments
- 5 years, 8 months ago by Luc Saffre about #3983 (The Uploads insert dialog doesn't close after uploading) : Yes, setting content type before trying anything fixed that issue. And then I must test the size already in handle_uploaded_files(), not in the models full_clean() method. So actually a huge file will still get uploaded, but at least it remains in the tmp directory and won't get copied to the upload...
- 5 years, 8 months ago by Luc Saffre about #3983 (The Uploads insert dialog doesn't close after uploading) : Ah yes: and when I raise a ValidationError because of the size limit, this code is never reached, so content type remains application/json. So I just must set the content type earlier. Also this magic of copying the handle_uploaded_files methods from the model to the actor seems obscure.
- 5 years, 8 months ago by Luc Saffre about #3983 (The Uploads insert dialog doesn't close after uploading) : Oh, I now discovered that the SubmitInsert action explicitly does ar.set_content_type('text/html') when the model has an handle_uploaded_files() method. And there is a comment, written by Tonis in July 2019: "Must set text/html for file uploads, otherwise the browser adds a <PRE>PRE</PRE> tag around...
- 5 years, 8 months ago by Luc Saffre about #3983 (The Uploads insert dialog doesn't close after uploading) : I compared behaviour of a runserver in avanti1 and our rumma production site (where the problem does not yet occur). The only difference is that on rumma the response is declared as text/html (which is wrong) while on avanti1 it is declared as application/json (which is true). So giving the wrong en...
- 5 years, 8 months ago by Luc Saffre about #3983 (The Uploads insert dialog doesn't close after uploading) : The JS console says "Uncaught TypeError: action.result is undefined". The end user sees no error message and the window simply remains open. So the user is tempted click a second time on the submit button. And every click will upload the file again. So we definitively need the UploadChecker to find ...