mirror of
https://github.com/1f349/go-webdav.git
synced 2024-12-23 00:34:23 +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
|
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.Size = getLen.Length
|
||||||
fi.ModTime = time.Time(getMod.LastModified)
|
fi.ModTime = time.Time(getMod.LastModified)
|
||||||
|
fi.MIMEType = getType.Type
|
||||||
}
|
}
|
||||||
|
|
||||||
return fi, nil
|
return fi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: getetag, getcontenttype
|
// TODO: getetag
|
||||||
var fileInfoPropfind = internal.NewPropNamePropfind(
|
var fileInfoPropfind = internal.NewPropNamePropfind(
|
||||||
internal.ResourceTypeName,
|
internal.ResourceTypeName,
|
||||||
internal.GetContentLengthName,
|
internal.GetContentLengthName,
|
||||||
internal.GetLastModifiedName,
|
internal.GetLastModifiedName,
|
||||||
|
internal.GetContentTypeName,
|
||||||
)
|
)
|
||||||
|
|
||||||
func (c *Client) Stat(name string) (*FileInfo, error) {
|
func (c *Client) Stat(name string) (*FileInfo, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user