fix: updateTime, createTime and HashInfo (#5111)

This commit is contained in:
Sean
2023-08-29 13:31:24 +08:00
committed by GitHub
parent ce10c9f120
commit 6308f1c35d
7 changed files with 64 additions and 10 deletions

View File

@ -12,6 +12,7 @@ import (
"path/filepath"
"strconv"
"strings"
"time"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/driver"
@ -103,7 +104,7 @@ func (d *Local) FileInfoToObj(f fs.FileInfo, reqPath string, fullPath string) mo
if !isFolder {
size = f.Size()
}
ctime := f.ModTime()
var ctime time.Time
t, err := times.Stat(stdpath.Join(fullPath, f.Name()))
if err == nil {
if t.HasBirthTime() {
@ -155,10 +156,18 @@ func (d *Local) Get(ctx context.Context, path string) (model.Obj, error) {
if isFolder {
size = 0
}
var ctime time.Time
t, err := times.Stat(path)
if err == nil {
if t.HasBirthTime() {
ctime = t.BirthTime()
}
}
file := model.Object{
Path: path,
Name: f.Name(),
Modified: f.ModTime(),
Ctime: ctime,
Size: size,
IsFolder: isFolder,
}