From 59f185da96c97a33fc95894de55611aa8838820f Mon Sep 17 00:00:00 2001 From: Bruno Michel Date: Thu, 1 Aug 2024 15:55:25 +0200 Subject: [PATCH] Fix downloading a webapp code from a git branch --- pkg/appfs/server.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/pkg/appfs/server.go b/pkg/appfs/server.go index ba7d92ad582..a8de5314a46 100644 --- a/pkg/appfs/server.go +++ b/pkg/appfs/server.go @@ -238,15 +238,19 @@ func (s *swiftServer) ServeCodeTarball(w http.ResponseWriter, req *http.Request, if err != nil { return err } + content, err := io.ReadAll(buf) + if err != nil { + return err + } contentType := mime.TypeByExtension(".gz") file, err := s.c.ObjectCreate(s.ctx, s.container, objName, true, "", contentType, nil) if err == nil { - _, _ = io.Copy(file, buf) + _, _ = io.Copy(file, bytes.NewReader(content)) _ = file.Close() } - return serveContent(w, req, contentType, int64(buf.Len()), buf) + return serveContent(w, req, contentType, int64(len(content)), bytes.NewReader(content)) } func (s *swiftServer) makeObjectName(slug, version, shasum, file string) string {