mirror of
https://github.com/rclone/rclone.git
synced 2024-11-08 01:25:14 +01:00
mailru: fix invalid timestamp on corrupted files (fixes #4229)
This commit is contained in:
parent
e5190f14ce
commit
18c7549770
@ -117,7 +117,7 @@ type ListItem struct {
|
|||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Home string `json:"home"`
|
Home string `json:"home"`
|
||||||
Size int64 `json:"size"`
|
Size int64 `json:"size"`
|
||||||
Mtime int64 `json:"mtime,omitempty"`
|
Mtime uint64 `json:"mtime,omitempty"`
|
||||||
Hash string `json:"hash,omitempty"`
|
Hash string `json:"hash,omitempty"`
|
||||||
VirusScan string `json:"virus_scan,omitempty"`
|
VirusScan string `json:"virus_scan,omitempty"`
|
||||||
Tree string `json:"tree,omitempty"`
|
Tree string `json:"tree,omitempty"`
|
||||||
|
@ -656,9 +656,14 @@ func (f *Fs) itemToDirEntry(ctx context.Context, item *api.ListItem) (entry fs.D
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, -1, err
|
return nil, -1, err
|
||||||
}
|
}
|
||||||
|
mTime := int64(item.Mtime)
|
||||||
|
if mTime < 0 {
|
||||||
|
fs.Debugf(f, "Fixing invalid timestamp %d on mailru file %q", mTime, remote)
|
||||||
|
mTime = 0
|
||||||
|
}
|
||||||
switch item.Kind {
|
switch item.Kind {
|
||||||
case "folder":
|
case "folder":
|
||||||
dir := fs.NewDir(remote, time.Unix(item.Mtime, 0)).SetSize(item.Size)
|
dir := fs.NewDir(remote, time.Unix(mTime, 0)).SetSize(item.Size)
|
||||||
dirSize := item.Count.Files + item.Count.Folders
|
dirSize := item.Count.Files + item.Count.Folders
|
||||||
return dir, dirSize, nil
|
return dir, dirSize, nil
|
||||||
case "file":
|
case "file":
|
||||||
@ -672,7 +677,7 @@ func (f *Fs) itemToDirEntry(ctx context.Context, item *api.ListItem) (entry fs.D
|
|||||||
hasMetaData: true,
|
hasMetaData: true,
|
||||||
size: item.Size,
|
size: item.Size,
|
||||||
mrHash: binHash,
|
mrHash: binHash,
|
||||||
modTime: time.Unix(item.Mtime, 0),
|
modTime: time.Unix(mTime, 0),
|
||||||
}
|
}
|
||||||
return file, -1, nil
|
return file, -1, nil
|
||||||
default:
|
default:
|
||||||
|
Loading…
Reference in New Issue
Block a user