Skip to content

Commit fe2c768

Browse files
committed
urlencode collection names
1 parent 495f842 commit fe2c768

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

vdirsyncer/storage/remotestorage.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
logger = log.get(__name__)
3131

3232
urljoin = utils.compat.urlparse.urljoin
33+
urlquote = utils.compat.urlquote
3334

3435

3536
def _ensure_slash(dir):
@@ -61,18 +62,20 @@ def __init__(self, account, scope, verify=True, verify_fingerprint=None,
6162
self._settings.update(prepare_verify(verify, verify_fingerprint))
6263

6364
self.scope = scope + ':rw'
64-
if collection:
65-
scope = urljoin(_ensure_slash(scope),
66-
_ensure_slash(collection))
67-
6865
self._session = OAuth2Session(
6966
CLIENT_ID, client=MobileApplicationClient(CLIENT_ID),
7067
scope=self.scope,
7168
redirect_uri=('data:text/html,<script>'
7269
'document.write(location.hash);</script>'),
7370
token={'access_token': access_token},
7471
)
75-
self._discover_endpoints(scope)
72+
73+
subpath = scope
74+
if collection:
75+
subpath = urljoin(_ensure_slash(scope),
76+
_ensure_slash(urlquote(collection)))
77+
78+
self._discover_endpoints(subpath)
7679

7780
if not access_token:
7881
self._get_access_token()

0 commit comments

Comments
 (0)