MCPcopy Create free account
hub / github.com/convox/rack / FilesDownload

Method FilesDownload

pkg/api/controllers.go:497–524  ·  view source on GitHub ↗
(c *stdapi.Context)

Source from the content-addressed store, hash-verified

495}
496
497func (s *Server) FilesDownload(c *stdapi.Context) error {
498 if err := s.hook("FilesDownloadValidate", c); err != nil {
499 return err
500 }
501
502 app := c.Var("app")
503 pid := c.Var("pid")
504 file := c.Value("file")
505
506 v, err := s.provider(c).WithContext(c.Context()).FilesDownload(app, pid, file)
507 if err != nil {
508 return err
509 }
510
511 if c, ok := interface{}(v).(io.Closer); ok {
512 defer c.Close()
513 }
514
515 if _, err := io.Copy(c, v); err != nil {
516 return err
517 }
518
519 if vs, ok := interface{}(v).(Sortable); ok {
520 sort.Slice(v, vs.Less)
521 }
522
523 return nil
524}
525
526func (s *Server) FilesUpload(c *stdapi.Context) error {
527 if err := s.hook("FilesUploadValidate", c); err != nil {

Callers

nothing calls this directly

Calls 7

hookMethod · 0.95
providerMethod · 0.95
ContextMethod · 0.80
SliceMethod · 0.80
FilesDownloadMethod · 0.65
WithContextMethod · 0.65
CloseMethod · 0.45

Tested by

no test coverage detected