fix(cloudreve_v4): improve token handling in Init method
This commit is contained in:
parent
7c8d17b95b
commit
959a5609cd
@ -31,12 +31,15 @@ func (d *CloudreveV4) GetAddition() driver.Additional {
|
||||
}
|
||||
|
||||
func (d *CloudreveV4) Init(ctx context.Context) error {
|
||||
if d.AccessToken != "" {
|
||||
return nil
|
||||
}
|
||||
// removing trailing slash
|
||||
d.Address = strings.TrimSuffix(d.Address, "/")
|
||||
op.MustSaveDriverStorage(d)
|
||||
if d.AccessToken != "" || d.RefreshToken != "" {
|
||||
return nil
|
||||
}
|
||||
if d.AccessToken == "" || d.RefreshToken != "" {
|
||||
return d.refreshToken()
|
||||
}
|
||||
return d.login()
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user