From 413faa99cf1a72b4328575cca47b035dc687c843 Mon Sep 17 00:00:00 2001 From: Substantiel Date: Thu, 9 Nov 2017 22:34:44 +0100 Subject: [PATCH] oauthutil: make sure auth server always finishes even when things go wrong --- oauthutil/oauthutil.go | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/oauthutil/oauthutil.go b/oauthutil/oauthutil.go index 3f545de72..e9bf4e830 100644 --- a/oauthutil/oauthutil.go +++ b/oauthutil/oauthutil.go @@ -428,17 +428,18 @@ func (s *authServer) Start() { fs.Debugf(nil, "Successfully got code") if s.code != nil { fmt.Fprintf(w, "

Success

\n

Go back to rclone to continue

") - s.code <- code } else { fmt.Fprintf(w, "

Success

\n

Cut and paste this code into rclone: %s

", code) } } - return + } else { + fs.Debugf(nil, "No code found on request") + w.WriteHeader(500) + fmt.Fprintf(w, "

Failed!

\nNo code found returned by remote server.") + } + if s.code != nil { + s.code <- code } - fs.Debugf(nil, "No code found on request") - w.WriteHeader(500) - fmt.Fprintf(w, "

Failed!

\nNo code found returned by remote server.") - }) var err error