mirror of https://github.com/Xhofe/alist
🐛 fix #658 onedrive file/folder judge
parent
90b57dacee
commit
796d490fb7
|
@ -175,7 +175,7 @@ func (driver Onedrive) Link(args base.Args, account *model.Account) (*base.Link,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if file.File.MimeType == "" {
|
if file.File == nil {
|
||||||
return nil, base.ErrNotFile
|
return nil, base.ErrNotFile
|
||||||
}
|
}
|
||||||
link := base.Link{
|
link := base.Link{
|
||||||
|
|
|
@ -120,7 +120,7 @@ type OneFile struct {
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
LastModifiedDateTime *time.Time `json:"lastModifiedDateTime"`
|
LastModifiedDateTime *time.Time `json:"lastModifiedDateTime"`
|
||||||
Url string `json:"@microsoft.graph.downloadUrl"`
|
Url string `json:"@microsoft.graph.downloadUrl"`
|
||||||
File struct {
|
File *struct {
|
||||||
MimeType string `json:"mimeType"`
|
MimeType string `json:"mimeType"`
|
||||||
} `json:"file"`
|
} `json:"file"`
|
||||||
Thumbnails []struct {
|
Thumbnails []struct {
|
||||||
|
@ -157,7 +157,7 @@ func (driver Onedrive) FormatFile(file *OneFile) *model.File {
|
||||||
if len(file.Thumbnails) > 0 {
|
if len(file.Thumbnails) > 0 {
|
||||||
f.Thumbnail = file.Thumbnails[0].Medium.Url
|
f.Thumbnail = file.Thumbnails[0].Medium.Url
|
||||||
}
|
}
|
||||||
if file.File.MimeType == "" {
|
if file.File == nil {
|
||||||
f.Type = conf.FOLDER
|
f.Type = conf.FOLDER
|
||||||
} else {
|
} else {
|
||||||
f.Type = utils.GetFileType(filepath.Ext(file.Name))
|
f.Type = utils.GetFileType(filepath.Ext(file.Name))
|
||||||
|
|
Loading…
Reference in New Issue