Skip to content

Commit 691e319

Browse files
authored
fix: handle file creation time retrieval correctly in getFileStats (#46)
1 parent 8b1ab02 commit 691e319

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

filesystemserver/handler.go

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -253,11 +253,19 @@ func (fs *FilesystemHandler) getFileStats(path string) (FileInfo, error) {
253253
return FileInfo{}, err
254254
}
255255

256-
timespec := times.Get(info)
256+
timespec, err := times.Stat(path)
257+
if err != nil {
258+
return FileInfo{}, fmt.Errorf("failed to get file times: %w", err)
259+
}
260+
261+
createdTime := time.Time{}
262+
if timespec.HasBirthTime() {
263+
createdTime = timespec.BirthTime()
264+
}
257265

258266
return FileInfo{
259267
Size: info.Size(),
260-
Created: timespec.BirthTime(),
268+
Created: createdTime,
261269
Modified: timespec.ModTime(),
262270
Accessed: timespec.AccessTime(),
263271
IsDirectory: info.IsDir(),

0 commit comments

Comments
 (0)