mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-22 16:24:14 +00:00
webdav: populate FileInfo.MIMEType in client
This commit is contained in:
parent
23fa5c582c
commit
82bdd23de4
@ -66,18 +66,25 @@ func fileInfoFromResponse(resp *internal.Response) (*FileInfo, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var getType internal.GetContentType
|
||||
if err := resp.DecodeProp(&getType); err != nil && !internal.IsNotFound(err) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
fi.Size = getLen.Length
|
||||
fi.ModTime = time.Time(getMod.LastModified)
|
||||
fi.MIMEType = getType.Type
|
||||
}
|
||||
|
||||
return fi, nil
|
||||
}
|
||||
|
||||
// TODO: getetag, getcontenttype
|
||||
// TODO: getetag
|
||||
var fileInfoPropfind = internal.NewPropNamePropfind(
|
||||
internal.ResourceTypeName,
|
||||
internal.GetContentLengthName,
|
||||
internal.GetLastModifiedName,
|
||||
internal.GetContentTypeName,
|
||||
)
|
||||
|
||||
func (c *Client) Stat(name string) (*FileInfo, error) {
|
||||
|
Loading…
Reference in New Issue
Block a user