Skip to content
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

Bug with URL quote/unquote #11

Closed
andrei-mart opened this issue May 29, 2017 · 6 comments
Closed

Bug with URL quote/unquote #11

andrei-mart opened this issue May 29, 2017 · 6 comments

Comments

@andrei-mart
Copy link
Contributor

in caldav/objects.py:
DAVObject._handle_prop_response() unqotes key it returns:
line 174:
href = unquote(r.find('.//' + dav.Href.tag).text)
but in DAVObject.get_properties it is compared to URL path, which is quoted:
lines 209-218:
path = self.url.path
exchange_path = self.url.path + '/'

    if path in list(properties.keys()):
        rc = properties[path]
    elif exchange_path in list(properties.keys()):
        rc = properties[exchange_path]
    else:
        raise Exception("The CalDAV server you are using has "
                        "a problem with path handling.")

So, if base path contains quoted characters, they do not match and the server is blamed.
Following modification makes it working for me:
lines 209-210:
path = unquote(self.url.path)
exchange_path = path + '/'

Also, a small optimisation in lines 212 and 214:
'in properties' is equivalent of 'in list(properties.keys())', but more effective.

@tobixen
Copy link
Member

tobixen commented May 30, 2017

I'm sorry to say that I have no capacity for the foreseeable future to look into this (though I'm not able to foresee much of the future - in the very best case, perhaps I will have time in some few weeks). Perhaps you could make a pull request? I think it's important to include some test code that throws an error with the current code in the pull request.

I'm generally having a low threshold for accepting pull requests, though I will do more thorough testing before the next release.

@andrei-mart
Copy link
Contributor Author

I am not sure I will find time to put together proper fix (with test), but I will try.

andrei-mart added a commit to andrei-mart/caldav that referenced this issue Jun 2, 2017
… quoted

Minor optimization of search in a dictionary
ref python-caldav#11
@JeyDee
Copy link

JeyDee commented Apr 8, 2018

I can confirm that this solves the problem (thank you very much for this, andrei-mart).
Can you please accept the pull request, tobixen?

@tobixen
Copy link
Member

tobixen commented Apr 8, 2018

pull request has been accepted, but I still didn't get to release a new version

@JeyDee
Copy link

JeyDee commented Apr 8, 2018

OK, I see. Thanks :).

@tobixen
Copy link
Member

tobixen commented Mar 9, 2019

I believe this was fixed and that this issue can be closed

@tobixen tobixen closed this as completed Mar 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants