Skip to content

Commit

Permalink
Include ModTime for directories if available
Browse files Browse the repository at this point in the history
  • Loading branch information
mzjulian authored Aug 11, 2021
1 parent 8efde26 commit 6238e10
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
Expand All @@ -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
}

Expand Down

0 comments on commit 6238e10

Please sign in to comment.