Окно обновления: форма уходит как обычная (urlencoded), сервер разбирает и multipart — «Обновить» у строки снова обновляет только её

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014FsEKyJrYF69Cj9ZXzFLRi
This commit is contained in:
zuevav
2026-09-24 22:28:49 +03:00
parent 56643cbe56
commit c45d8632ca
2 changed files with 8 additions and 2 deletions
+5 -1
View File
@@ -1401,7 +1401,11 @@ func (h *setupHandlers) applyUpdate(w http.ResponseWriter, r *http.Request) {
http.Error(w, "method", http.StatusMethodNotAllowed)
return
}
_ = r.ParseForm()
// форма может прийти и как multipart (окно обновления) — иначе имена компонентов теряются
// и «Обновить» у одной строки превращается в «Обновить всё»
if err := r.ParseMultipartForm(1 << 20); err != nil {
_ = r.ParseForm()
}
names := r.Form["component"]
rc := h.rc
save := func(msg string, err error) string {
+3 -1
View File
@@ -612,7 +612,9 @@ label { font-size:13px; font-weight:500; }
bar.style.width=Math.max(3,Math.round(e.loaded/e.total*25))+'%'; detail.textContent=mb(e.loaded)+' из '+mb(e.total); } };
}
xhr.onloadend=function(){ postDone=true; };
xhr.send(new FormData(form));
// обычные формы — как браузер (urlencoded), с файлом — multipart
if(file && file.files.length){ xhr.send(new FormData(form)); }
else { xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded'); xhr.send(new URLSearchParams(new FormData(form)).toString()); }
setTimeout(poll, 400);
}
function poll(){