Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

serve http: added content-length header when html directory is served

Sunny6356b51b33d9
diff --git a/lib/http/serve/dir.go b/lib/http/serve/dir.go
index 1cfcc454b..664f81cf2 100644
--- a/lib/http/serve/dir.go
+++ b/lib/http/serve/dir.go
@@ -235,6 +235,7 @@ func (d *Directory) Serve(w http.ResponseWriter, r *http.Request) {
Error(d.DirRemote, w, "Failed to render template", err)
return
}
+ w.Header().Set("Content-Length", fmt.Sprintf("%d", buf.Len()))
_, err = buf.WriteTo(w)
if err != nil {
Error(d.DirRemote, nil, "Failed to drain template buffer", err)