Add error toast for 413 content too large response on image uploads (#1675)

Co-authored-by: SleeplessOne1917 <abias1122@gmail.com>
This commit is contained in:
Sander Saarend 2023-06-29 05:53:15 +03:00 committed by GitHub
parent 0764b75dc2
commit bca438b2c6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 0 deletions

View file

@ -443,6 +443,10 @@ export class MarkdownTextArea extends Component<
const textarea: any = document.getElementById(i.id);
autosize.update(textarea);
pictrsDeleteToast(image.name, res.data.delete_url as string);
} else if (res.data.msg === "too_large") {
toast(I18NextService.i18n.t("upload_too_large"), "danger");
i.setState({ imageUploadStatus: undefined });
throw JSON.stringify(res.data);
} else {
throw JSON.stringify(res.data);
}