Prod upload fix

This commit is contained in:
julien
2026-03-22 11:26:31 +01:00
parent 2061d680f9
commit 4e8fa3660f
2 changed files with 18 additions and 2 deletions

View File

@@ -103,10 +103,23 @@
}
});
var payload = await response.json();
var contentType = response.headers.get('content-type') || '';
var raw = await response.text();
var payload = {};
if (contentType.indexOf('application/json') !== -1) {
try {
payload = JSON.parse(raw);
} catch (parseError) {
payload = {};
}
}
if (!response.ok) {
throw new Error(payload.error || 'Le téléversement a échoué.');
throw new Error(
payload.error
|| ('HTTP ' + response.status + (raw ? ' - ' + raw.slice(0, 180) : ''))
);
}
setFeedback('Image téléversée. Rafraîchissement…', false);

View File

@@ -2,6 +2,9 @@ server {
listen 80;
server_name _;
# Aligne la limite Nginx avec PHP pour éviter les 413 HTML sur les uploads.
client_max_body_size 8M;
root /var/www/app/public;
index index.php;