mirror of
https://github.com/mickael-kerjean/filestash
synced 2025-12-24 09:13:11 +01:00
fix (plg_plugin_webdav): IIS compat
This commit is contained in:
parent
a75a33d49b
commit
ee6256e075
1 changed files with 8 additions and 2 deletions
|
|
@ -151,7 +151,7 @@ func (w WebDav) Cat(path string) (io.ReadCloser, error) {
|
|||
return nil, err
|
||||
}
|
||||
if res.StatusCode >= 400 {
|
||||
return nil, NewError(HTTPFriendlyStatus(res.StatusCode)+": can't create "+filepath.Base(path), res.StatusCode)
|
||||
return nil, NewError(HTTPFriendlyStatus(res.StatusCode)+": can't fetch "+filepath.Base(path), res.StatusCode)
|
||||
}
|
||||
return res.Body, nil
|
||||
}
|
||||
|
|
@ -216,9 +216,15 @@ func (w WebDav) request(method string, url string, body io.Reader, fn func(req *
|
|||
if w.params.username != "" {
|
||||
req.SetBasicAuth(w.params.username, w.params.password)
|
||||
}
|
||||
|
||||
req.Header.Add("Content-Type", "text/xml;charset=UTF-8")
|
||||
req.Header.Add("Accept", "application/xml,text/xml")
|
||||
req.Header.Add("Accept-Charset", "utf-8")
|
||||
switch method {
|
||||
case "GET":
|
||||
req.Header.Add("Accept", "*/*")
|
||||
default:
|
||||
req.Header.Add("Accept", "application/xml,text/xml")
|
||||
}
|
||||
|
||||
if req.Body != nil {
|
||||
defer req.Body.Close()
|
||||
|
|
|
|||
Loading…
Reference in a new issue