client: improve error message on failed upload
ci/woodpecker/push/build Pipeline was successful Details
ci/woodpecker/push/lint-foundkey-js Pipeline was successful Details
ci/woodpecker/push/lint-client Pipeline was successful Details
ci/woodpecker/push/lint-backend Pipeline was successful Details
ci/woodpecker/push/lint-sw Pipeline was successful Details
ci/woodpecker/push/test Pipeline was successful Details

Changelog: Fixed
Ref: https://github.com/misskey-dev/misskey/issues/8574
This commit is contained in:
Johann150 2023-04-20 17:58:09 +02:00
parent 4fbbfff145
commit 3a73f2c3de
Signed by: Johann150
GPG Key ID: 9EE6577A2A06F8F1
2 changed files with 13 additions and 2 deletions

View File

@ -233,6 +233,9 @@ resetAreYouSure: "Really reset?"
saved: "Saved"
messaging: "Chat"
upload: "Upload"
uploadFailed: "Upload failed"
uploadFailedDescription: "The file could not be uploaded."
uploadFailedSize: "The file is too large to be uploaded."
keepOriginalUploading: "Keep original image"
keepOriginalUploadingDescription: "Saves the originally uploaded image as-is. If turned\
\ off, a version to display on the web will be generated on upload."

View File

@ -83,10 +83,18 @@ export function uploadFile(
// TODO: 消すのではなくて再送できるようにしたい
uploads.value = uploads.value.filter(x => x.id !== id);
let text = i18n.ts.uploadFailedDescription;
if (xhr.status == 413) {
// the file was too large
text = i18n.ts.uploadFailedSize;
} else if (xhr.response?.error?.message != null) {
text = xhr.response?.error?.message;
}
alert({
type: 'error',
title: 'Failed to upload',
text: `${JSON.stringify(ev.target?.response)}, ${JSON.stringify(xhr.response)}`,
title: i18n.ts.uploadFailed,
text,
});
reject();