Skip to content

Commit

Permalink
fix(189cloudpc): wrong modified time (close #910)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Apr 6, 2022
1 parent 24d031d commit 5295593
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions drivers/189pc/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ func (driver Cloud189) Files(path string, account *model.Account) ([]model.File,
Size: 0,
Type: conf.FOLDER,
Driver: driver.Config().Name,
UpdatedAt: MustParseTime(folder.CreateDate),
UpdatedAt: MustParseTime(folder.LastOpTime),
})
}
for _, file := range resp.FileListAO.FileList {
Expand All @@ -239,7 +239,7 @@ func (driver Cloud189) Files(path string, account *model.Account) ([]model.File,
Size: file.Size,
Type: utils.GetFileType(filepath.Ext(file.Name)),
Driver: driver.Config().Name,
UpdatedAt: MustParseTime(file.CreateDate),
UpdatedAt: MustParseTime(file.LastOpTime),
Thumbnail: file.Icon.SmallUrl,
})
}
Expand Down
5 changes: 3 additions & 2 deletions drivers/189pc/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,9 @@ func BoolToNumber(b bool) int {
}

func MustParseTime(str string) *time.Time {
time, _ := http.ParseTime(str)
return &time
loc, _ := time.LoadLocation("Local")
lastOpTime, _ := time.ParseInLocation("2006-01-02 15:04:05", str, loc)
return &lastOpTime
}

type Params map[string]string
Expand Down

0 comments on commit 5295593

Please sign in to comment.