From 987584f27c9b39623f67460915ccc1629372a869 Mon Sep 17 00:00:00 2001 From: Hans-Petter Fjeld Date: Tue, 1 Oct 2024 21:23:04 +0200 Subject: [PATCH] Fix issue #4000 - implement --disable-dir-list for rclone serve http --- MANUAL.html | 1 + MANUAL.md | 1 + MANUAL.txt | 1 + cmd/serve/http/http.go | 8 ++++---- docs/content/commands/rclone_serve_http.md | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/MANUAL.html b/MANUAL.html index d4b683fec..cc22aa8c4 100644 --- a/MANUAL.html +++ b/MANUAL.html @@ -5143,6 +5143,7 @@ htpasswd -B htpasswd anotherUser --client-ca string Client certificate authority to verify clients with --dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-perms FileMode Directory permissions (default 777) + --disable-dir-list Disable HTML directory list on GET request for a directory --file-perms FileMode File permissions (default 666) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) -h, --help help for http diff --git a/MANUAL.md b/MANUAL.md index 11e520ba8..8f448cbc9 100644 --- a/MANUAL.md +++ b/MANUAL.md @@ -10162,6 +10162,7 @@ rclone serve http remote:path [flags] --client-ca string Client certificate authority to verify clients with --dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-perms FileMode Directory permissions (default 777) + --disable-dir-list Disable HTML directory list on GET request for a directory --file-perms FileMode File permissions (default 666) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) -h, --help help for http diff --git a/MANUAL.txt b/MANUAL.txt index 0c2d0d066..8b6398f36 100644 --- a/MANUAL.txt +++ b/MANUAL.txt @@ -9702,6 +9702,7 @@ Options --client-ca string Client certificate authority to verify clients with --dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-perms FileMode Directory permissions (default 777) + --disable-dir-list Disable HTML directory list on GET request for a directory --file-perms FileMode File permissions (default 666) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) -h, --help help for http diff --git a/cmd/serve/http/http.go b/cmd/serve/http/http.go index 5a74870af..a26a79259 100644 --- a/cmd/serve/http/http.go +++ b/cmd/serve/http/http.go @@ -33,7 +33,7 @@ type Options struct { Auth libhttp.AuthConfig HTTP libhttp.Config Template libhttp.TemplateConfig - DisableGETDir bool + DisableDirList bool } // DefaultOpt is the default values used for Options @@ -41,7 +41,7 @@ var DefaultOpt = Options{ Auth: libhttp.DefaultAuthCfg(), HTTP: libhttp.DefaultCfg(), Template: libhttp.DefaultTemplateCfg(), - DisableGETDir: false, + DisableDirList: false, } // Opt is options set by command line flags @@ -58,7 +58,7 @@ func init() { libhttp.AddTemplateFlagsPrefix(flagSet, flagPrefix, &Opt.Template) vfsflags.AddFlags(flagSet) proxyflags.AddFlags(flagSet) - flags.BoolVarP(flagSet, &Opt.DisableGETDir, "disable-dir-list", "", false, "Disable HTML directory list on GET request for a directory", "") + flagSet.BoolVarP(&Opt.DisableDirList, "disable-dir-list", "", false, "Disable HTML directory list on GET request for a directory") } // Command definition for cobra @@ -234,7 +234,7 @@ func (s *HTTP) serveDir(w http.ResponseWriter, r *http.Request, dirRemote string http.Error(w, "Internal Server Error", http.StatusInternalServerError) } return - } else { + } // Make the entries for display diff --git a/docs/content/commands/rclone_serve_http.md b/docs/content/commands/rclone_serve_http.md index 9206d6f8a..d8a1cdce8 100644 --- a/docs/content/commands/rclone_serve_http.md +++ b/docs/content/commands/rclone_serve_http.md @@ -627,6 +627,7 @@ rclone serve http remote:path [flags] --client-ca string Client certificate authority to verify clients with --dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-perms FileMode Directory permissions (default 777) + --disable-dir-list Disable HTML directory list on GET request for a directory --file-perms FileMode File permissions (default 666) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) -h, --help help for http