summaryrefslogtreecommitdiff
path: root/server.go
diff options
context:
space:
mode:
authorache <ache@ache.one>2019-02-17 20:57:18 +0100
committerache <ache@ache.one>2019-02-17 20:57:18 +0100
commitffa1aff4618fa82f8d63540f58a6b8715d7ec62c (patch)
treeac7fab7c8035c326331c0b7c98852ddd0412343b /server.go
parentMethod delete (diff)
Fix Path
Diffstat (limited to 'server.go')
-rw-r--r--server.go13
1 files changed, 8 insertions, 5 deletions
diff --git a/server.go b/server.go
index 3228bef..de88dcf 100644
--- a/server.go
+++ b/server.go
@@ -43,6 +43,7 @@ func handleGet( w http.ResponseWriter, r *http.Request, headOnly bool) {
type Entry struct {
Name string
+ Path string
Size int64
}
@@ -72,16 +73,18 @@ func handleGet( w http.ResponseWriter, r *http.Request, headOnly bool) {
}
}
+ initPath := r.URL.Path;
- cols = append(cols, Entry{".", 0})
- if filename != "." {
- cols = append(cols, Entry{"..", 0})
+ cols = append(cols, Entry{".", initPath, 0})
+ if initPath != "/" {
+ cols = append(cols, Entry{"..", path.Dir(initPath), 0})
+ initPath += "/"
}
for _, file := range fileInfo {
if file.IsDir() {
- cols = append(cols, Entry{file.Name(), 0})
+ cols = append(cols, Entry{file.Name(), initPath + file.Name(), 0})
} else {
- files = append(files, Entry{file.Name(), file.Size()})
+ files = append(files, Entry{file.Name(), initPath + file.Name(), file.Size()})
}
}
type Collection struct {