studio-b12 / gowebdav

A golang WebDAV client library and command line tool.
BSD 3-Clause "New" or "Revised" License
309 stars 89 forks source link

Can't upload file with content #20

Closed MrVine closed 6 years ago

MrVine commented 6 years ago

Hello Collaborators, during testing current version of gowebdav I notice that client's method WriteStream does not set request body even if body should be set for current request (for example during uploading non-empty file via gowebdav.exe -X PUT /my_folder/file.txt file.txt). Also, @chuckwagoncomputing face with this problem too, but he used propfind request instead.

Software

To Reproduce

  1. build gowebdav/cmd/gowebdav with go build to get gowebdav.exe
  2. set following environment's variables:
    1. ROOT -- WebDav Server's URL
    2. USER -- WebDav Server's username
    3. PASSWORD -- WebDav Server's password
  3. suppose your WebDav Server's folder is my_folder, and your local file to upload located near gowebdav.exe, named file.txt and has some text (so actually file's size is not zero).
  4. run following command: gowebdav.exe -X PUT /my_folder/file.txt file.txt
  5. go to your WebDav Server via any other interface (putty, web browser etc), and you will see that file is exist but file's size is zero

Expected Uploaded file contains body

Actually Uploaded file does not contains body

MrVine commented 6 years ago

This bug was fixed by pull-request #21