added back anchor and selfheal broken chunks

This commit is contained in:
ston1th 2022-10-09 01:12:05 +02:00
commit 6122768619
8 changed files with 65 additions and 44 deletions

View file

@ -25,9 +25,10 @@ const (
)
type data struct {
QuotaCur float64
QuotaMax float64
Paths dirContents
QuotaCur float64
QuotaMax float64
Paths dirContents
PathAnchor string
}
type FileServer struct {
@ -136,7 +137,7 @@ func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.Del("Last-Modified")
paths, err := i.GetPaths(p, fs.fs, false)
paths, pathAnchor, err := i.GetPaths(p, fs.fs, false)
if err == io.EOF {
w.WriteHeader(i.Status())
return
@ -148,7 +149,7 @@ func (fs *FileServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
h.Set(csp, indexCSP)
w.WriteHeader(i.Status())
err = index.Execute(w, data{Paths: paths})
err = index.Execute(w, data{Paths: paths, PathAnchor: pathAnchor})
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return