diff options
-rw-r--r-- | server.go | 13 |
1 files changed, 8 insertions, 5 deletions
@@ -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 { |