Окно обновления: форма уходит как обычная (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:
@@ -1401,7 +1401,11 @@ func (h *setupHandlers) applyUpdate(w http.ResponseWriter, r *http.Request) {
|
|||||||
http.Error(w, "method", http.StatusMethodNotAllowed)
|
http.Error(w, "method", http.StatusMethodNotAllowed)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// форма может прийти и как multipart (окно обновления) — иначе имена компонентов теряются
|
||||||
|
// и «Обновить» у одной строки превращается в «Обновить всё»
|
||||||
|
if err := r.ParseMultipartForm(1 << 20); err != nil {
|
||||||
_ = r.ParseForm()
|
_ = r.ParseForm()
|
||||||
|
}
|
||||||
names := r.Form["component"]
|
names := r.Form["component"]
|
||||||
rc := h.rc
|
rc := h.rc
|
||||||
save := func(msg string, err error) string {
|
save := func(msg string, err error) string {
|
||||||
|
|||||||
@@ -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); } };
|
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.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);
|
setTimeout(poll, 400);
|
||||||
}
|
}
|
||||||
function poll(){
|
function poll(){
|
||||||
|
|||||||
Reference in New Issue
Block a user