support for video and improvements
This commit is contained in:
@@ -12,11 +12,18 @@ import (
|
||||
// ServeSingle serves a single file in an editor (if it is editable), shows the
|
||||
// plain file, or downloads it if it can't be shown.
|
||||
func ServeSingle(w http.ResponseWriter, r *http.Request, c *config.Config, u *config.User, i *file.Info) (int, error) {
|
||||
err := i.Read()
|
||||
if err != nil {
|
||||
var err error
|
||||
|
||||
if err = i.RetrieveFileType(); err != nil {
|
||||
return errors.ErrorToHTTPCode(err, true), err
|
||||
}
|
||||
|
||||
if i.Type == "text" {
|
||||
if err = i.Read(); err != nil {
|
||||
return errors.ErrorToHTTPCode(err, true), err
|
||||
}
|
||||
}
|
||||
|
||||
p := &page.Page{
|
||||
Info: &page.Info{
|
||||
Name: i.Name(),
|
||||
|
||||
Reference in New Issue
Block a user