oauthutil: make sure auth server always finishes even when things go wrong
This commit is contained in:
parent
ed91d6b5a5
commit
413faa99cf
1 changed files with 7 additions and 6 deletions
|
@ -428,17 +428,18 @@ func (s *authServer) Start() {
|
||||||
fs.Debugf(nil, "Successfully got code")
|
fs.Debugf(nil, "Successfully got code")
|
||||||
if s.code != nil {
|
if s.code != nil {
|
||||||
fmt.Fprintf(w, "<h1>Success</h1>\n<p>Go back to rclone to continue</p>")
|
fmt.Fprintf(w, "<h1>Success</h1>\n<p>Go back to rclone to continue</p>")
|
||||||
s.code <- code
|
|
||||||
} else {
|
} else {
|
||||||
fmt.Fprintf(w, "<h1>Success</h1>\n<p>Cut and paste this code into rclone: <code>%s</code></p>", code)
|
fmt.Fprintf(w, "<h1>Success</h1>\n<p>Cut and paste this code into rclone: <code>%s</code></p>", code)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return
|
} else {
|
||||||
}
|
|
||||||
fs.Debugf(nil, "No code found on request")
|
fs.Debugf(nil, "No code found on request")
|
||||||
w.WriteHeader(500)
|
w.WriteHeader(500)
|
||||||
fmt.Fprintf(w, "<h1>Failed!</h1>\nNo code found returned by remote server.")
|
fmt.Fprintf(w, "<h1>Failed!</h1>\nNo code found returned by remote server.")
|
||||||
|
}
|
||||||
|
if s.code != nil {
|
||||||
|
s.code <- code
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
var err error
|
var err error
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue