fix(settings): never-silent avatar upload errors (LC-439) #438
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/avatar-upload-error-feedback"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Oversized avatar uploads failed silently on Settings > Profile (ref data/ref-profile.png). Subtask of LC-426.
Root cause
/settings/profilehad no per-route body limit, so it used Axum's default ~2 MiB. The handler's own 1 MiB check returns a proper error fragment for files in the 1-2 MiB range, but a typical phone photo (>2 MiB) was 413'd by the body-limit layer BEFORE the handler ran. htmx doesn't swap non-2xx, so the request just no-op'd: no error, no success, no save (the client preview still showed the picked file, so it looked like it worked).Fix - three layers, so a save can never be silent
/settings/profileallows up to 6 MiB so the handler's 1 MiB check runs and returns the existing visible error fragment instead of a 413. The handler still rejects anything over 1 MiB.htmx:responseError/htmx:sendErrorlistener surfaces a generic error in the triggering form's status slot + a toast for any non-2xx / network failure - so EVERY Save button always ends in success or error (covers 413/500/network across the whole settings page).New i18n: settings-avatar-err-size / -err-type, js-settings-save-error (en + es). New test
oversized_avatar_hx_returns_error_fragment_not_413(a 3 MiB body - over the old 2 MiB cap - now reaches the handler and returns 200 +.lc-status--err, not a 413).just check,just test,just test-saaspass; settings.js syntax-checked; Tailwind rebuilt.🤖 Generated with Claude Code