onedrive: handle HTTP 400 better in PublicLink() (#5419)

This commit is contained in:
Alex Chen
2021-07-27 17:55:57 +08:00
committed by GitHub
parent bc74f0621e
commit 63a24255f8
2 changed files with 12 additions and 1 deletions

View File

@@ -1500,7 +1500,9 @@ func (f *Fs) PublicLink(ctx context.Context, remote string, expire fs.Duration,
return shouldRetry(ctx, resp, err)
})
if err != nil {
fmt.Println(err)
if resp != nil && resp.StatusCode == 400 && f.driveType != driveTypePersonal {
return "", errors.Errorf("%v (is making public links permitted by the org admin?)", err)
}
return "", err
}