uploads: fix broken tests.

* Fix broken upload tests.
* Fix uploads to return an error if both a file and a source are given
  at the same time, or if neither are given. Also fix the error message
  in this case so that it doesn't include "base" at the start of the string.
* Fix uploads to percent-encode any Unicode characters in the source URL.
* Add a max filesize validation to media assets.
This commit is contained in:
evazion
2022-01-29 04:38:47 -06:00
parent 5d0c14d2bd
commit 11b7bcac91
9 changed files with 248 additions and 611 deletions

View File

@@ -110,7 +110,13 @@ export default class FileUploadComponent {
async onError(e) {
let errors = e.originalEvent.detail[0].errors;
let message = Object.keys(errors).map(attribute => {
return errors[attribute].map(error => `${capitalize(attribute)} ${error}`);
return errors[attribute].map(error => {
if (attribute === "base") {
return `${error}`;
} else {
return `${capitalize(attribute)} ${error}`;
}
});
}).join("; ");
Utility.error(message);