🐛 fix empty refresh_token

pull/548/head
微凉 2021-12-16 14:07:15 +08:00
parent fe79f9518b
commit b2055777e0
1 changed files with 5 additions and 0 deletions

View File

@ -1,6 +1,7 @@
package onedrive package onedrive
import ( import (
"errors"
"fmt" "fmt"
"github.com/Xhofe/alist/conf" "github.com/Xhofe/alist/conf"
"github.com/Xhofe/alist/drivers/base" "github.com/Xhofe/alist/drivers/base"
@ -93,6 +94,10 @@ func (driver Onedrive) RefreshToken(account *model.Account) error {
} else { } else {
account.Status = "work" account.Status = "work"
} }
if resp.RefreshToken == "" {
account.Status = "empty refresh_token"
return errors.New("empty refresh_token")
}
account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken account.RefreshToken, account.AccessToken = resp.RefreshToken, resp.AccessToken
return nil return nil
} }