Permalink
Browse files

Modify RenderFile to call RenderBinary.

  • Loading branch information...
1 parent e693f0c commit 34d8c95b07177943689ab8bd77f0da7278513ef1 @jcvernaleo jcvernaleo committed Jul 31, 2013
Showing with 2 additions and 11 deletions.
  1. +2 −11 controller.go
View
@@ -179,23 +179,14 @@ func (c *Controller) RenderFile(file *os.File, delivery ContentDisposition) Resu
if fileInfo != nil {
modtime = fileInfo.ModTime()
}
- return &BinaryResult{
- Reader: file,
- Name: filepath.Base(file.Name()),
- Delivery: delivery,
- Length: -1, // http.ServeContent gets the length itself
- ModTime: modtime,
- }
+ return c.RenderBinary(file, filepath.Base(file.Name()), delivery, modtime)
}
// RenderBinary is like RenderFile() except that it instead of a file on disk,
// it renders data from memory (which could be a file that has not been written,
// the output from some function, or bytes streamed from somewhere else, as long
// it implements io.Reader).
-func (c *Controller) RenderBinary(memfile io.Reader, filename string, delivery ContentDisposition) Result {
- var (
- modtime = time.Now()
- )
+func (c *Controller) RenderBinary(memfile io.Reader, filename string, delivery ContentDisposition, modtime time.Time) Result {
return &BinaryResult{
Reader: memfile,
Name: filename,

0 comments on commit 34d8c95

Please sign in to comment.