fix(webdav): set mime by ext if it's empty

This commit is contained in:
Noah Hsu
2022-10-09 19:29:55 +08:00
parent 30f992c6a8
commit 8c69260972
4 changed files with 16 additions and 7 deletions

View File

@ -300,6 +300,9 @@ func (h *Handler) handlePut(w http.ResponseWriter, r *http.Request) (status int,
ReadCloser: r.Body,
Mimetype: r.Header.Get("Content-Type"),
}
if stream.Mimetype == "" {
stream.Mimetype = utils.GetMimeType(reqPath)
}
err = fs.PutDirectly(ctx, path.Dir(reqPath), stream)
// TODO(rost): Returning 405 Method Not Allowed might not be appropriate.