feat: handle 404 on propfind
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.
why not use gowebdav.IsErrNotFound(err) ?
why not use
gowebdav.IsErrNotFound(err)?
That didn't work for me when I used gowebdav.Stat over files that 404'd.
Thank you for your pull request.
I see this as a path towards a more consistent API.
gowebdav.IsErrNotFound(err) doesn't work, because the status code may not be available at this time.
In this particular case it is enough to add this 404 error handling into requests.go but with return newPathError("PROPFIND", path, rs.StatusCode) instead of return newNotExistError() to get IsErrorNotFound(err) working.
Thank you for your pull request. I see this as a path towards a more consistent API.
gowebdav.IsErrNotFound(err)doesn't work, because the status code may not be available at this time. In this particular case it is enough to add this404error handling intorequests.gobut withreturn newPathError("PROPFIND", path, rs.StatusCode)instead ofreturn newNotExistError()to getIsErrorNotFound(err)working.
Done!
I kept thinking that maybe using newPathError("PROPFIND", path, rs.StatusCode) for any rs.StatusCode > 400 maybe be more future proof, even if we don't have handlers for those errors yet. But I will leave that to you that know the project much better :)
Thank You!!! You have massively improved the project.
this was not that issue. it may be an other one, we need to find them. please run the tests and file suspicious result. if you writing an own client, consider the reference implementation cmd/gowebdav. thank you!