(c *stdapi.Context)
| 495 | } |
| 496 | |
| 497 | func (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 | |
| 526 | func (s *Server) FilesUpload(c *stdapi.Context) error { |
| 527 | if err := s.hook("FilesUploadValidate", c); err != nil { |
nothing calls this directly
no test coverage detected