From f68b60148425d35263956bbcfc13beeeada5601d Mon Sep 17 00:00:00 2001 From: Naeel Date: Mon, 23 Mar 2026 10:47:25 +0300 Subject: [PATCH] =?UTF-8?q?fix(web-console):=20zip=20invalid=20=E2=80=94?= =?UTF-8?q?=20Close()=20=D0=BF=D0=BE=D1=81=D0=BB=D0=B5=20Bytes()=20(v0.1.6?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- services/funcs/funcs-service.yaml | 2 +- services/funcs/main.go | 29 ++++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/services/funcs/funcs-service.yaml b/services/funcs/funcs-service.yaml index 8278fd9..50bb308 100644 --- a/services/funcs/funcs-service.yaml +++ b/services/funcs/funcs-service.yaml @@ -27,7 +27,7 @@ spec: spec: containers: - name: funcs - image: naeel/sless-funcs-service:v0.1.5 + image: naeel/sless-funcs-service:v0.1.6 ports: - containerPort: 8090 env: diff --git a/services/funcs/main.go b/services/funcs/main.go index ee7f657..bd1fd7e 100644 --- a/services/funcs/main.go +++ b/services/funcs/main.go @@ -605,16 +605,16 @@ func env(key, fallback string) string { // Принимает code (основной файл) + deps (requirements.txt / package.json). func proxyCreateFunction(w http.ResponseWriter, r *http.Request, operatorURL, serviceToken, ns string) { var req struct { - Name string `json:"name"` - Runtime string `json:"runtime"` - Kind string `json:"kind"` // "service" | "function"; default "service" - Code string `json:"code"` - Filename string `json:"filename"` - Deps string `json:"deps"` // содержимое requirements.txt / package.json - DepsFile string `json:"deps_filename"` // "requirements.txt" или "package.json" - Entrypoint string `json:"entrypoint"` - MemoryMB int `json:"memory_mb"` - TimeoutSec int `json:"timeout_sec"` + Name string `json:"name"` + Runtime string `json:"runtime"` + Kind string `json:"kind"` // "service" | "function"; default "service" + Code string `json:"code"` + Filename string `json:"filename"` + Deps string `json:"deps"` // содержимое requirements.txt / package.json + DepsFile string `json:"deps_filename"` // "requirements.txt" или "package.json" + Entrypoint string `json:"entrypoint"` + MemoryMB int `json:"memory_mb"` + TimeoutSec int `json:"timeout_sec"` } if err := json.NewDecoder(r.Body).Decode(&req); err != nil { http.Error(w, `{"error":"invalid JSON"}`, http.StatusBadRequest) @@ -699,8 +699,8 @@ func proxySaveFunction(w http.ResponseWriter, r *http.Request, operatorURL, serv var req struct { Code string `json:"code"` Filename string `json:"filename"` - Kind string `json:"kind"` // "function" | "service" - Deps string `json:"deps"` // содержимое requirements.txt / package.json + Kind string `json:"kind"` // "function" | "service" + Deps string `json:"deps"` // содержимое requirements.txt / package.json DepsFile string `json:"deps_filename"` // имя файла зависимостей } if err := json.NewDecoder(r.Body).Decode(&req); err != nil || req.Code == "" || req.Filename == "" { @@ -774,7 +774,10 @@ func buildZipFiles(files map[string]string) ([]byte, error) { return nil, err } } - return buf.Bytes(), zw.Close() + if err := zw.Close(); err != nil { + return nil, err + } + return buf.Bytes(), nil } // proxyFnStatus отдаёт текущий phase+url функции/сервиса — используется для UI polling.