fix(web-console): zip invalid — Close() после Bytes() (v0.1.6)
This commit is contained in:
@@ -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:
|
||||
|
||||
+16
-13
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user