refactor and remove useless stuff
Former-commit-id: 31f37b7a4487e7d0b5763f07f52b8f2b6157a4cd [formerly 8143cd383b7cd35339a21e93ec4d24ba91039708] [formerly 35ea25e79b4bea4d58edfb1745b844fcb12d91d9 [formerly 06c4e4d58bc50b245c78ca3f15d7512fcc16e92b]] Former-commit-id: e7f57997c2640adcfff36b605a99da9786aed3cb [formerly 2d63af9ef7a090b597239d5c0aeaf056e6366efc] Former-commit-id: cf7d129de97b0f289a6c35fa1ce9b070d9d6eac9
This commit is contained in:
@@ -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 = "/"
|
||||
|
||||
Reference in New Issue
Block a user