mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FIX: Confusing vague upload error (#23347)
When an upload fails and we don't have a specific error, we show a generic one. But it's a little too generic -- it doesn't even include the file name. This commit shows the file name so you at least know which of your uploads failed.
This commit is contained in:
parent
5a810fd6cc
commit
253d4a154c
@ -329,14 +329,14 @@ export function displayErrorForUpload(data, siteSettings, fileName) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// otherwise, display a generic error message
|
// otherwise, display a generic error message
|
||||||
dialog.alert(I18n.t("post.errors.upload"));
|
dialog.alert(I18n.t("post.errors.upload", { file_name: fileName }));
|
||||||
}
|
}
|
||||||
|
|
||||||
function displayErrorByResponseStatus(status, body, fileName, siteSettings) {
|
function displayErrorByResponseStatus(status, body, fileName, siteSettings) {
|
||||||
switch (status) {
|
switch (status) {
|
||||||
// didn't get headers from server, or browser refuses to tell us
|
// didn't get headers from server, or browser refuses to tell us
|
||||||
case 0:
|
case 0:
|
||||||
dialog.alert(I18n.t("post.errors.upload"));
|
dialog.alert(I18n.t("post.errors.upload", { file_name: fileName }));
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
// entity too large, usually returned from the web server
|
// entity too large, usually returned from the web server
|
||||||
|
@ -390,7 +390,9 @@ module("Unit | Utility | uploads", function (hooks) {
|
|||||||
"test.png"
|
"test.png"
|
||||||
);
|
);
|
||||||
assert.ok(
|
assert.ok(
|
||||||
dialog.alert.calledWith(I18n.t("post.errors.upload")),
|
dialog.alert.calledWith(
|
||||||
|
I18n.t("post.errors.upload", { file_name: "test.png" })
|
||||||
|
),
|
||||||
"the alert is called"
|
"the alert is called"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -3465,7 +3465,7 @@ en:
|
|||||||
errors:
|
errors:
|
||||||
create: "Sorry, there was an error creating your post. Please try again."
|
create: "Sorry, there was an error creating your post. Please try again."
|
||||||
edit: "Sorry, there was an error editing your post. Please try again."
|
edit: "Sorry, there was an error editing your post. Please try again."
|
||||||
upload: "Sorry, there was an error uploading that file. Please try again."
|
upload: "Sorry, there was an error uploading %{file_name}. Please try again."
|
||||||
file_too_large: "Sorry, that file is too big (maximum size is %{max_size_kb}kb). Why not upload your large file to a cloud sharing service, then paste the link?"
|
file_too_large: "Sorry, that file is too big (maximum size is %{max_size_kb}kb). Why not upload your large file to a cloud sharing service, then paste the link?"
|
||||||
file_size_zero: "Sorry, it looks like something has gone wrong, the file you are trying to upload is 0 bytes. Please try again."
|
file_size_zero: "Sorry, it looks like something has gone wrong, the file you are trying to upload is 0 bytes. Please try again."
|
||||||
file_too_large_humanized: "Sorry, that file is too big (maximum size is %{max_size}). Why not upload your large file to a cloud sharing service, then paste the link?"
|
file_too_large_humanized: "Sorry, that file is too big (maximum size is %{max_size}). Why not upload your large file to a cloud sharing service, then paste the link?"
|
||||||
|
Loading…
Reference in New Issue
Block a user