🐛 fix #658 onedrive file/folder judge

pull/662/head
Xhofe 2022-03-03 16:01:24 +08:00
parent 90b57dacee
commit 796d490fb7
2 changed files with 3 additions and 3 deletions

View File

@ -175,7 +175,7 @@ func (driver Onedrive) Link(args base.Args, account *model.Account) (*base.Link,
if err != nil {
return nil, err
}
if file.File.MimeType == "" {
if file.File == nil {
return nil, base.ErrNotFile
}
link := base.Link{

View File

@ -120,7 +120,7 @@ type OneFile struct {
Size int64 `json:"size"`
LastModifiedDateTime *time.Time `json:"lastModifiedDateTime"`
Url string `json:"@microsoft.graph.downloadUrl"`
File struct {
File *struct {
MimeType string `json:"mimeType"`
} `json:"file"`
Thumbnails []struct {
@ -157,7 +157,7 @@ func (driver Onedrive) FormatFile(file *OneFile) *model.File {
if len(file.Thumbnails) > 0 {
f.Thumbnail = file.Thumbnails[0].Medium.Url
}
if file.File.MimeType == "" {
if file.File == nil {
f.Type = conf.FOLDER
} else {
f.Type = utils.GetFileType(filepath.Ext(file.Name))