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

Creating parent collection method was added #22

Closed MrVine closed 6 years ago

MrVine commented 6 years ago

When I reading sources of gowebdav I found that Client.createParentCollection() method is required in some places, and marked with TODO statements. So, in this pull request I do:

  1. Add Client.createParentCollection(itemPath string) error method to Client's structure
  2. Use this method inside Client.Write(path string, data []byte, _ os.FileMode) error method in case of 409 response
  3. Use this method inside Client.WriteStream(path string, stream io.Reader, _ os.FileMode) error method
  4. Use this method inside Client.copymove(method string, oldpath string, newpath string, overwrite bool) error method in case of 409 response

NOTE: I think Client.Write() and Client.WriteStream() methods should be refactored to use c.createParentCollection() in the same way, because now Client.WriteStream() method always trying to create parent collection but Client.Write() method trying to create parent collection only in case of 409 error

UPDATE: Also .travis.yml file was changed to install dependencies before tests running.

chripo commented 6 years ago

thumbs up!