1
mirror of https://github.com/rclone/rclone synced 2024-11-25 02:47:14 +01:00

Fix issue #4000 - implement --disable-dir-list for rclone serve http

This commit is contained in:
Hans-Petter Fjeld 2024-10-01 21:23:04 +02:00
parent d55b9f1279
commit 987584f27c
5 changed files with 8 additions and 4 deletions

1
MANUAL.html generated
View File

@ -5143,6 +5143,7 @@ htpasswd -B htpasswd anotherUser</code></pre>
--client-ca string Client certificate authority to verify clients with --client-ca string Client certificate authority to verify clients with
--dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-cache-time Duration Time to cache directory entries for (default 5m0s)
--dir-perms FileMode Directory permissions (default 777) --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) --file-perms FileMode File permissions (default 666)
--gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000)
-h, --help help for http -h, --help help for http

1
MANUAL.md generated
View File

@ -10162,6 +10162,7 @@ rclone serve http remote:path [flags]
--client-ca string Client certificate authority to verify clients with --client-ca string Client certificate authority to verify clients with
--dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-cache-time Duration Time to cache directory entries for (default 5m0s)
--dir-perms FileMode Directory permissions (default 777) --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) --file-perms FileMode File permissions (default 666)
--gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000)
-h, --help help for http -h, --help help for http

1
MANUAL.txt generated
View File

@ -9702,6 +9702,7 @@ Options
--client-ca string Client certificate authority to verify clients with --client-ca string Client certificate authority to verify clients with
--dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-cache-time Duration Time to cache directory entries for (default 5m0s)
--dir-perms FileMode Directory permissions (default 777) --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) --file-perms FileMode File permissions (default 666)
--gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000)
-h, --help help for http -h, --help help for http

View File

@ -33,7 +33,7 @@ type Options struct {
Auth libhttp.AuthConfig Auth libhttp.AuthConfig
HTTP libhttp.Config HTTP libhttp.Config
Template libhttp.TemplateConfig Template libhttp.TemplateConfig
DisableGETDir bool DisableDirList bool
} }
// DefaultOpt is the default values used for Options // DefaultOpt is the default values used for Options
@ -41,7 +41,7 @@ var DefaultOpt = Options{
Auth: libhttp.DefaultAuthCfg(), Auth: libhttp.DefaultAuthCfg(),
HTTP: libhttp.DefaultCfg(), HTTP: libhttp.DefaultCfg(),
Template: libhttp.DefaultTemplateCfg(), Template: libhttp.DefaultTemplateCfg(),
DisableGETDir: false, DisableDirList: false,
} }
// Opt is options set by command line flags // Opt is options set by command line flags
@ -58,7 +58,7 @@ func init() {
libhttp.AddTemplateFlagsPrefix(flagSet, flagPrefix, &Opt.Template) libhttp.AddTemplateFlagsPrefix(flagSet, flagPrefix, &Opt.Template)
vfsflags.AddFlags(flagSet) vfsflags.AddFlags(flagSet)
proxyflags.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 // 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) http.Error(w, "Internal Server Error", http.StatusInternalServerError)
} }
return return
} else { }
// Make the entries for display // Make the entries for display

View File

@ -627,6 +627,7 @@ rclone serve http remote:path [flags]
--client-ca string Client certificate authority to verify clients with --client-ca string Client certificate authority to verify clients with
--dir-cache-time Duration Time to cache directory entries for (default 5m0s) --dir-cache-time Duration Time to cache directory entries for (default 5m0s)
--dir-perms FileMode Directory permissions (default 777) --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) --file-perms FileMode File permissions (default 666)
--gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000) --gid uint32 Override the gid field set by the filesystem (not supported on Windows) (default 1000)
-h, --help help for http -h, --help help for http