mirror of
https://github.com/rclone/rclone.git
synced 2024-12-22 15:11:56 +01:00
oauthutil: avoid panic when *token
and *ts.token
are the same
the field `raw` of `oauth2.Token` may be an uncomparable type(often map[string]interface{}), causing `*token != *ts.token` expression to panic(comparing uncomparable type ...). the semantics of comparing whether two tokens are the same can be achieved by comparing accessToken, refreshToken and expire to avoid panic.
This commit is contained in:
parent
d977fa25fa
commit
451d7badf7
@ -292,7 +292,7 @@ func (ts *TokenSource) Token() (*oauth2.Token, error) {
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("couldn't fetch token: %w", err)
|
||||
}
|
||||
changed = changed || (*token != *ts.token)
|
||||
changed = changed || token.AccessToken != ts.token.AccessToken || token.RefreshToken != ts.token.RefreshToken || token.Expiry != ts.token.Expiry
|
||||
ts.token = token
|
||||
if changed {
|
||||
// Bump on the expiry timer if it is set
|
||||
|
Loading…
Reference in New Issue
Block a user