mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 08:14:15 +00:00
Include ModTime for directories if available
This commit is contained in:
parent
8efde26ef9
commit
6238e10e65
13
client.go
13
client.go
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user