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

oauthutil: fix crash when webrowser requests /robots.txt - fixes #5836

Nick Craig-Wood3425726c503f
diff --git a/lib/oauthutil/oauthutil.go b/lib/oauthutil/oauthutil.go
index 2203a0e47..56c936d71 100644
--- a/lib/oauthutil/oauthutil.go
+++ b/lib/oauthutil/oauthutil.go
@@ -691,6 +691,11 @@ func newAuthServer(opt *Options, bindAddress, state, authURL string) *authServer
// Receive the auth request
func (s *authServer) handleAuth(w http.ResponseWriter, req *http.Request) {
+ if req.URL.Path != "/" {
+ fs.Debugf(nil, "Ignoring %s request on auth server to %q", req.Method, req.URL.Path)
+ http.NotFound(w, req)
+ return
+ }
fs.Debugf(nil, "Received %s request on auth server to %q", req.Method, req.URL.Path)
// Reply with the response to the user and to the channel
@@ -752,10 +757,6 @@ func (s *authServer) Init() error {
}
s.server.SetKeepAlivesEnabled(false)
- mux.HandleFunc("/favicon.ico", func(w http.ResponseWriter, req *http.Request) {
- http.Error(w, "", http.StatusNotFound)
- return
- })
mux.HandleFunc("/auth", func(w http.ResponseWriter, req *http.Request) {
state := req.FormValue("state")
if state != s.state {