Include ModTime for directories if available

This commit is contained in:
jumo98 2021-08-11 11:08:03 +02:00 committed by GitHub
parent 8efde26ef9
commit 6238e10e65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -86,6 +86,7 @@ func fileInfoFromResponse(resp *internal.Response) (*FileInfo, error) {
if err := resp.DecodeProp(&resType); err != nil {
return nil, err
}
if resType.Is(internal.CollectionName) {
fi.IsDir = true
} else {
@ -94,11 +95,6 @@ func fileInfoFromResponse(resp *internal.Response) (*FileInfo, error) {
return nil, err
}
var getMod internal.GetLastModified
if err := resp.DecodeProp(&getMod); err != nil && !internal.IsNotFound(err) {
return nil, err
}
var getType internal.GetContentType
if err := resp.DecodeProp(&getType); err != nil && !internal.IsNotFound(err) {
return nil, err
@ -110,11 +106,16 @@ func fileInfoFromResponse(resp *internal.Response) (*FileInfo, error) {
}
fi.Size = getLen.Length
fi.ModTime = time.Time(getMod.LastModified)
fi.MIMEType = getType.Type
fi.ETag = string(getETag.ETag)
}
var getMod internal.GetLastModified
if err := resp.DecodeProp(&getMod); err != nil && !internal.IsNotFound(err) {
return nil, err
}
fi.ModTime = time.Time(getMod.LastModified)
return fi, nil
}