Skip to content

Commit

Permalink
Fix downloading a webapp code from a git branch
Browse files Browse the repository at this point in the history
  • Loading branch information
nono committed Aug 1, 2024
1 parent 1ca1184 commit 59f185d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions pkg/appfs/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 59f185d

Please sign in to comment.