Commit Graph

160 Commits

Author SHA1 Message Date
Christoph Polcin
fbeb69f25b Add client tests 2022-10-16 00:59:05 +02:00
Christoph Polcin
4adca27344 uses log instead of fmt 2022-10-15 14:44:49 +02:00
Felipe Martin Garcia
8190232c06
feat: handle 404 on propfind (#57)
Client.Stat was not returning a proper Go err for not found files, the
ideal way to check this is using `errors.Is(err, fs.ErrNotExist)` but
the client was returning a generic error.

I've updated the `propfind` to take 404 errors into account, retuning
the above error making easier to evaluate that kind of situations.
2022-10-13 23:11:52 +02:00
zhijian
e70a598e94
supports get range offset with unkown length (#58)
https://www.rfc-editor.org/rfc/rfc9110.html#name-byte-ranges
2022-10-12 18:09:28 +02:00
Ringo Hoffmann
c7b1ff8a5e
Improve Error Handling (#54)
* bubble up request errors [#28]

* inhibit stream close on request

* add `StatusError`

* `PUT`: check if given target is a directory

* Revert "inhibit stream close on request"

Cherry-picked into branch dev-bodyclosing.

This reverts commit 2889239999.

Co-authored-by: Christoph Polcin <coco@miconoco.de>
2022-01-28 17:20:35 +01:00
Christoph Polcin
a047320e42 Updates README 2022-01-27 16:33:26 +01:00
Christoph Polcin
b5bd04e2b5 Escapes destination path on copy and move #42 2022-01-27 16:32:05 +01:00
Ringo Hoffmann
3f8721cd4b fix crash when req is called with no body 2021-11-09 09:32:28 +01:00
Ringo Hoffmann
adba8dc051 add .vscode directory 2021-11-09 09:32:28 +01:00
Ringo Hoffmann
2f2cda4122 use seeker when available on request 2021-11-08 09:54:01 +01:00
Ringo Hoffmann
73a7f0bf37 add artifacts workflow 2021-11-07 22:37:54 +01:00
Ringo Hoffmann
aff231de53 add github workflow for unit tests 2021-11-07 22:36:17 +01:00
Ringo Hoffmann
e5dd1e70b1 create go module 2021-11-07 22:35:47 +01:00
Christoph Polcin
29e74efa70
Merge pull request #46 from jkowalski/read-stream-range
added ReadStreamRange() method to efficiently read a range of data
2021-11-06 10:05:35 +01:00
Jarek Kowalski
741fdbda3d added ReadStreamRange() method to efficiently read a range of data
It passes "Range: bytes=X-Y" and if the server returns HTTP 206,
we know it complied with the request.

For servers that don't understand range and return HTTP 200 instead we
discard some bytes and limit the result to emulate this behavior.

This will greatly help https://github.com/kopia/kopia which relies on
partial reads from pack blobs.
2021-11-04 23:32:32 -07:00
Christoph Polcin
a3a86976a1
Merge pull request #45 from marcelblijleven/master
Fix index out of range runtime error when empty string is provided to FixSlashes
2021-09-17 15:32:50 +02:00
Marcel Blijleven
a2cbdfa976 Fix index out of range runtime error when provided string is empty 2021-09-17 13:24:28 +02:00
Marcel Blijleven
9a1ba21162 Fix typo in description 2021-09-17 13:23:09 +02:00
Mark Severson
7ff61aa87b Handle request errors in copymove 2021-06-30 12:06:26 +02:00
Christoph Polcin
86f8378cf1 Update API description 2021-04-27 23:21:33 +02:00
Felix Pojtinger
4145fa842c Add ability to define custom interceptors (fixes #35) 2021-04-27 23:12:51 +02:00
David Holdeman
8244b5a5f5
Merge pull request #41 from needsaholiday/bug/pluscharacter
fix unescape
2021-02-03 15:23:56 -06:00
Nick Kratzke
d02a1ebcd2 switched to PathUnescape 2021-02-03 21:16:30 +01:00
Nick
3ed042db71 fix unescape 2021-02-03 15:25:12 +01:00
Christoph Polcin
bdacfab947 update README due to API changes 2020-09-29 10:07:39 +02:00
Jarek Kowalski
617404b525 fixed panic due to concurrent map writes
Fixes #36
2020-09-28 11:17:19 +02:00
Christoph Polcin
9380631c29 update README 2020-03-03 16:07:24 +01:00
Lukáš Lalinský
a93005d73c
Add File.Path to return the full path (#34)
Very useful when iterating over ReadDir results and wanting to do some operation on them.
2020-03-03 15:28:06 +01:00
vitalii
321978fa73 ref: make names more descriptive 2019-12-15 01:31:08 +02:00
vitalii
c4c707907d fix method of getting user's home path 2019-12-15 01:28:41 +02:00
Justus Flerlage
9f625b1b8e Added check for root path 2019-11-14 22:08:20 +02:00
Justus Flerlage
e53b818e1b Added check of parentPath in createParentCollection 2019-11-14 22:08:20 +02:00
vitalii
ff7f737904 fix(requests.go): allow www-authenticate to be case-insensitive. close #32 2019-10-05 22:13:01 +03:00
vitalii
38f79aeaf1 fix uploading file with wrong content. close #30 2019-01-03 20:40:47 +02:00
vitalii
6c32839dbd fix import for command line tool 2018-12-30 13:28:02 +02:00
vitalii
4d70d7ea28 use 'application/xml' instead of 'text/xml'. related with (1) in #15 2018-12-29 22:04:04 +02:00
yatsen1
8bcb1b383c Fix early defer panic. (#29) 2018-11-08 09:39:42 +01:00
vitalii
cba565a9dc links was updated in readme file. Related to studio-b12/gowebdav#27
RFC 2518 was removed because it is obsolete
RFC 4918 was added because it is actual
RFC 5689 was added because it updates RFC 4918
2018-10-24 14:05:51 +03:00
vitalii
425530b55e cmd: readme was updated. closes studio-b12/gowebdav#27
Wrapper script section was updated
2018-10-22 08:29:10 +03:00
vitalii
7493d8befb readme file for command line tool was added
Close #27
2018-10-22 08:10:23 +03:00
vitalii
e29bc0f031 main readme file was updated 2018-10-22 08:09:12 +03:00
vitalii
c8fc9ca590 Merge remote-tracking branch 'upstream/master' 2018-10-21 12:52:46 +03:00
vitalii
a68e21e92b requests: nil pointer dereference panic was fixed [#25]
http.Do() method will return non-nil [error] in following cases:
1. Request is nil
2. Response missing Location header
3. Client failed to parse Location header
4. Method "request.GetBody()" returns error
5. Http.Client.Send() returns error
5. Client timeout was exceeded

Signed-off-by: Christoph Polcin <labs@polcin.de>
2018-10-21 11:15:52 +02:00
vitalii
02aa9bdaeb unused imports was removed 2018-10-20 23:08:19 +03:00
vitalii
8de8ce169b Merge remote-tracking branch 'upstream/master' 2018-07-17 14:00:43 +03:00
Christoph Polcin
3cd755d6c4 make check api 2018-07-14 01:55:58 +02:00
Vitalii
83e3d1e31e Creating parent collection method was added (#22)
* method for creating parent collection was added to Client struct

"func (c *Client) createParentCollection(itemPath string) error" was added to request.go file

* using Client's method to create parent collection

in following methods:
Client.Write()
Client.WriteStream()
Client.copymove()

deadlock is impossible in method Client.copymove() because of paragraph #6 section 9.8.5 (https://tools.ietf.org/html/rfc4918#section-9.8.5) and paragraph #6 section 9.9.4 (https://tools.ietf.org/html/rfc4918#section-9.9.4) of RFC 4918 (https://tools.ietf.org/html/rfc4918)

* install dependencies script was added to Travis-CI file

* testing was added to Travis-CI file

* error wrapping was removed from Client.put() method

* using an early return on error in case of 409 in Client.Write() method
2018-07-14 01:48:30 +02:00
Christoph Polcin
28039fda22 fmt 2018-07-13 12:12:09 +02:00
Christoph Polcin
45a56c2115 cmd: remove Connect() due to #16 2018-07-13 12:11:56 +02:00
vitalii
f821ab73e9 Merge branch 'b12-master' 2018-07-11 12:41:49 +03:00