anvc / scalar

Born-digital, open source, media-rich scholarly publishing that’s as easy as blogging.
Other
231 stars 73 forks source link

Error message returns JSON parse error in alert to user #221

Open alexdryden opened 1 year ago

alexdryden commented 1 year ago

When uploading a media item with a file extension that isn't allowed, a JSON parse error message is displayed instead of the the custom error text: Screenshot 2023-09-15 at 11 48 16 AM

This is because the error message is not passed with the self keyword here: https://github.com/anvc/scalar/blob/a9165f1fc34d0834b911c11757b92fc47b9d15bf/system/application/libraries/File_Upload.php#L61 It should be throw new Exception(self::FILE_NAME_NOT_ALLOWED);. I can submit a pr for this along with the other error message related issue.

craigdietrich commented 1 year ago

A pull request here, too, would be excellent, thanks @alexdryden !