diff --git a/console/deploy/console.yaml b/console/deploy/console.yaml index 961e24b..3e8688d 100644 --- a/console/deploy/console.yaml +++ b/console/deploy/console.yaml @@ -52,7 +52,7 @@ spec: serviceAccountName: fission-console containers: - name: console - image: naeel/fission-console:v1.3.38 + image: naeel/fission-console:v1.3.39 imagePullPolicy: Always ports: - containerPort: 8090 diff --git a/console/internal/api/lint_archive.go b/console/internal/api/lint_archive.go index 6ba625d..3ddb663 100644 --- a/console/internal/api/lint_archive.go +++ b/console/internal/api/lint_archive.go @@ -5,6 +5,7 @@ import ( "bytes" "context" "encoding/json" + "errors" "fmt" "net/http" "os" @@ -41,12 +42,19 @@ func (s *Server) handleLintArchive(w http.ResponseWriter, r *http.Request) { return } - // Ограничиваем тело запроса — не более maxArchiveBytes (+ небольшой overhead для multipart) - r.Body = http.MaxBytesReader(w, r.Body, maxArchiveBytes+4*1024) + // Hard-limit 10 MB чтобы соединение не обрывалось (MaxBytesReader с маленьким лимитом + // закрывает соединение до отправки ответа — клиент получает 000 вместо 413). + // Реальный лимит размера архива проверяется после чтения файла. + r.Body = http.MaxBytesReader(w, r.Body, 10*1024*1024) if err := r.ParseMultipartForm(maxArchiveBytes); err != nil { - writeJSONError(w, http.StatusRequestEntityTooLarge, - fmt.Sprintf("архив слишком большой: максимум %d KB", maxArchiveBytes/1024)) + var maxErr *http.MaxBytesError + if errors.As(err, &maxErr) { + writeJSONError(w, http.StatusRequestEntityTooLarge, + fmt.Sprintf("архив слишком большой: максимум %d KB", maxArchiveBytes/1024)) + } else { + writeJSONError(w, http.StatusBadRequest, "ошибка разбора multipart: "+err.Error()) + } return } diff --git a/console/ui/index.html b/console/ui/index.html index 744f6fa..3fe7ac1 100644 --- a/console/ui/index.html +++ b/console/ui/index.html @@ -100,7 +100,7 @@