mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2024-01-19 02:48:24 +00:00
Merge pull request #3250 from xdadrm/xdadrm-patch-xweo-byte-files-from-webdav
Fixes WebDAV 0-bytes files
This commit is contained in:
commit
dc6b1a52e8
|
@ -48,6 +48,13 @@ type WebDavServer struct {
|
||||||
Handler *webdav.Handler
|
Handler *webdav.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func max(x, y int64) int64 {
|
||||||
|
if x <= y {
|
||||||
|
return y
|
||||||
|
}
|
||||||
|
return x
|
||||||
|
}
|
||||||
|
|
||||||
func NewWebDavServer(option *WebDavOption) (ws *WebDavServer, err error) {
|
func NewWebDavServer(option *WebDavOption) (ws *WebDavServer, err error) {
|
||||||
|
|
||||||
fs, _ := NewWebDavFileSystem(option)
|
fs, _ := NewWebDavFileSystem(option)
|
||||||
|
@ -496,6 +503,7 @@ func (f *WebDavFile) Write(buf []byte) (int, error) {
|
||||||
written, err := f.bufWriter.Write(buf)
|
written, err := f.bufWriter.Write(buf)
|
||||||
|
|
||||||
if err == nil {
|
if err == nil {
|
||||||
|
f.entry.Attributes.FileSize = uint64(max(f.off+int64(written), int64(f.entry.Attributes.FileSize)))
|
||||||
glog.V(3).Infof("WebDavFileSystem.Write %v: written [%d,%d)", f.name, f.off, f.off+int64(len(buf)))
|
glog.V(3).Infof("WebDavFileSystem.Write %v: written [%d,%d)", f.name, f.off, f.off+int64(len(buf)))
|
||||||
f.off += int64(written)
|
f.off += int64(written)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue