mirror of
https://github.com/rclone/rclone.git
synced 2025-01-03 04:49:47 +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
2be627aa56
commit
9979b9d082
@ -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