mirror of
https://github.com/rclone/rclone
synced 2024-11-24 01:26:25 +01:00
rcd: prefix patch for rcd and web-gui
This commit is contained in:
parent
efd826ad4b
commit
159f2e29a8
@ -26,9 +26,8 @@ func AddFlagsPrefix(flagSet *pflag.FlagSet, prefix string, Opt *httplib.Options)
|
||||
flags.StringVarP(flagSet, &Opt.Realm, prefix+"realm", "", Opt.Realm, "realm for authentication")
|
||||
flags.StringVarP(flagSet, &Opt.BasicUser, prefix+"user", "", Opt.BasicUser, "User name for authentication.")
|
||||
flags.StringVarP(flagSet, &Opt.BasicPass, prefix+"pass", "", Opt.BasicPass, "Password for authentication.")
|
||||
if prefix == "" {
|
||||
flags.StringVarP(flagSet, &Opt.Prefix, prefix+"prefix", "", Opt.Prefix, "Prefix for URLs.")
|
||||
}
|
||||
flags.StringVarP(flagSet, &Opt.Prefix, prefix+"prefix", "", Opt.Prefix, "Prefix for URLs.")
|
||||
|
||||
}
|
||||
|
||||
// AddFlags adds flags for the httplib
|
||||
|
@ -138,7 +138,11 @@ func writeError(path string, in rc.Params, w http.ResponseWriter, err error, sta
|
||||
|
||||
// handler reads incoming requests and dispatches them
|
||||
func (s *Server) handler(w http.ResponseWriter, r *http.Request) {
|
||||
path := strings.TrimLeft(r.URL.Path, "/")
|
||||
urlPath, ok := s.Path(w, r)
|
||||
if !ok {
|
||||
return
|
||||
}
|
||||
path := strings.TrimLeft(urlPath, "/")
|
||||
|
||||
allowOrigin := rcflags.Opt.AccessControlAllowOrigin
|
||||
if allowOrigin != "" {
|
||||
@ -311,6 +315,7 @@ func (s *Server) handleGet(w http.ResponseWriter, r *http.Request, path string)
|
||||
return
|
||||
case s.files != nil:
|
||||
// Serve the files
|
||||
r.URL.Path = "/" + path
|
||||
s.files.ServeHTTP(w, r)
|
||||
return
|
||||
case path == "" && s.opt.Serve:
|
||||
|
Loading…
Reference in New Issue
Block a user