-
Notifications
You must be signed in to change notification settings - Fork 79
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FIX Strip html tags from file upload error responses #1138
FIX Strip html tags from file upload error responses #1138
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@emteknetnz The goal was to produce readable error messages for users, which I'd argue simply stripping the HTML tags does not achieve. With the example in the original issue, an author would now see:
413 Request Entity Too Large
The author might infer that this means their file was too big, but it's not exactly a clear description, and other errors may not fair as well. I think you'd be better off creating a map of HTTP error codes to author-readable messages and using those if the response is a string. If developers want to push through a custom error message, they need to make sure they return a valid JSON response with the errors
key populated.
cc/ @silverstripeux - maybe you can collaborate on the error messaging?
Linking to #895 (comment) as I've just added some designs with four different error messages that we'd like to add in an instance that an extension is not allowed or a file is too big etc. We can come up with a few more if need be but these should allow you to cover the most common errors. |
eb2d484
to
4822605
Compare
4822605
to
33b0003
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking good, one small recommended change.
Nice work! |
Fixes silverstripe#967 introduced in silverstripe#1138
Fixes silverstripe#967 introduced in silverstripe#1138
Fixes silverstripe#967 introduced in silverstripe#1138
Fixes #915
Notes
Update transifix
New behaviour:
File Manager Gallery Server Error 413
File Manager Gallery Server Error - Non-413
Upload Field Error - Server Error 413
Upload Field Error - Server Error Non-413
Non Server Error file size too big messaging remains as is
Error can be simulated in File manager gallery by updating AssetAdmin.php
Error can be simulated in upload field by updating UploadField.php
Add an upload field to Page.php