Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"File too large" error formatted incorrectly #8574

Closed
ThatOneCalculator opened this issue Apr 30, 2022 · 2 comments · Fixed by #10680
Closed

"File too large" error formatted incorrectly #8574

ThatOneCalculator opened this issue Apr 30, 2022 · 2 comments · Fixed by #10680
Labels
1️⃣ Good First Issue 🐛Bug Unexpected behavior packages/frontend Client side specific issue/PR

Comments

@ThatOneCalculator
Copy link
Contributor

💡 Summary

The "File too large" error has incorrect formatting

🥰 Expected Behavior

Correctly formatted error

🤬 Actual Behavior

20220429_182817280_c2a1.jpg

📝 Steps to Reproduce

  1. Go to drive
  2. Upload too large file

📌 Environment

Misskey version: 12.110.1
Your OS: iOS
Your browser: Chrome

@ThatOneCalculator ThatOneCalculator added the ⚠️bug? This might be a bug label Apr 30, 2022
@Johann150 Johann150 added 🐛Bug Unexpected behavior packages/frontend Client side specific issue/PR 1️⃣ Good First Issue and removed ⚠️bug? This might be a bug labels May 31, 2022
@Johann150
Copy link
Contributor

To fix this, the code below should show a respective error message instead of the current one (text) if the 413 response status code is detected. A new internationalization string would need to be added.

alert({
type: 'error',
title: 'Failed to upload',
text: `${JSON.stringify(ev.target?.response)}, ${JSON.stringify(xhr.response)}`
});

Would be nice to also fix the title to also be internationalized instead of hard coded as English in the process.

@tinaxd
Copy link
Contributor

tinaxd commented Apr 20, 2023

In the current develop branch, if the server returns 413 with a non-JSON response, no error is displayed on the frontend because the JSON parsing fails and an uncaught exception is raised.

if (xhr.status !== 200 || ev.target == null || ev.target.response == null) {
// TODO: 消すのではなくて(ネットワーク的なエラーなら)再送できるようにしたい
uploads.value = uploads.value.filter(x => x.id !== id);
if (ev.target?.response) {
const res = JSON.parse(ev.target.response);
if (res.error?.id === 'bec5bd69-fba3-43c9-b4fb-2894b66ad5d2') {

As @Johann150 mentioned, we can solve this by displaying a user-friendly error message when status code 413 is detected.
May I start working on this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1️⃣ Good First Issue 🐛Bug Unexpected behavior packages/frontend Client side specific issue/PR
Projects
None yet
3 participants