-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to enable trailing slashes #136
Comments
It looks like Line 549 in 7604957
And Line 307 in 7604957
Maybe |
|
Maybe this client should always follow redirects to handle both servers which require trailing slash and which require to trim it. |
Hello, I got the same issue. At the moment I'm forced to dynamically patch (monkey patch) the wrap_fn to force I'm considering to propose a pull request based on the following. I think that a valid possibility would be to remove the def propfind(
self,
path: str,
data: str = None,
headers: "HeaderTypes" = None,
# follow_redirects: bool = False, # Remove this line, but API break
) -> "MultiStatusResponse":
"""Returns properties of the specific resource by propfind request."""
call = wrap_fn(
self._request,
HTTPMethod.PROPFIND,
path,
content=data,
headers=headers,
# follow_redirects=follow_redirects
)
http_resp = self.with_retry(call)
return parse_multistatus_response(http_resp) If we want to not break the propfind API we can also add the follow_redirects in the wrap_fn function call only if it is true. def propfind(
self,
path: str,
data: str = None,
headers: "HeaderTypes" = None,
follow_redirects: bool = False,
) -> "MultiStatusResponse":
"""Returns properties of the specific resource by propfind request."""
client_opts = {"follow_redirects": True} if follow_redirects else {}
call = wrap_fn(
self._request,
HTTPMethod.PROPFIND,
path,
content=data,
headers=headers,
**client_opts
)
http_resp = self.with_retry(call)
return parse_multistatus_response(http_resp) With such change, the WebdavFilesystem (or Client) should be instantiated with the follow_redirects=True in the client_opts like in the following example: from webdav4.fsspec import WebdavFileSystem
fs2 = WebdavFileSystem(
"https://my-webdav-repo.com",
auth=(user, pass),
follow_redirects=True
) By doing so, we should also add an option to the CLI in order to add a I'm new with webdav4 so maybe I missed something. |
Hi, sorry for the late response. The issue here is that the standard WebDAV servers expect the PROPFIND call for collections/dirs to be made to URL with a trailing slash, i.e. Path handling definitely needs to improve (#3) in webdav4. I'm okay with setting |
In my opinion, a clean solution would be to remove the parameter |
The problem still exists though, if The temporary fix here is to get rid of |
|
The WebDAV server I work with expectets trailing
/
at the end of directory urls and I can't figure out how to do this with this library (it's a 3rd-party service, so I can't change the server behaviour).In any case of
the URL is normalized to
https://theuser.your-storagebox.de/abc
, which then yields aHTTPError
because of 301 redirect tohttps://theuser.your-storagebox.de/abc/
.Is there a way to manually set an URL with trailing slashes or to enable trailing slashes as default? I'm happy to help if needed.
The text was updated successfully, but these errors were encountered: