refactor and remove useless stuff

This commit is contained in:
Henrique Dias committed 2017-06-27 14:49:46 +01:00
1 parent 6e04c97bb9
commit 06c4e4d58b
4 files changed
+6 -17

No files matched your search

+1 -9
View File
@@ -5,26 +5,18 @@ import (
"net/http"
"strconv"
"strings"
"github.com/mholt/caddy/caddyhttp/httpserver"
)
// serveListing presents the user with a listage of a directory folder.
func serveListing(c *requestContext, w http.ResponseWriter, r *http.Request) (int, error) {
var err error
// Loads the content of the directory
// Loads the content of the directory.
listing, err := getListing(c.us, c.fi.VirtualPath, c.fm.RootURL()+r.URL.Path)
if err != nil {
return errorToHTTP(err, true), err
}
listing.Context = httpserver.Context{
Root: http.Dir(c.us.scope),
Req: r,
URL: r.URL,
}
cookieScope := c.fm.RootURL()
if cookieScope == "" {
cookieScope = "/"