Skip to content

Commit

Permalink
Reverse urlencoding (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn authored Jul 26, 2017
1 parent e0e48fb commit ac405e6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pyls/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ class Workspace(object):
M_SHOW_MESSAGE = 'window/showMessage'

def __init__(self, root, lang_server=None):
self._url_parsed = urlparse(unquote(root))
self.root = self._url_parsed.path
self._url_parsed = urlparse(root)
self.root = unquote(self._url_parsed.path)
self._docs = {}
self._lang_server = lang_server

Expand Down
8 changes: 5 additions & 3 deletions test/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,12 @@ def test_non_root_project(pyls):


def test_urlencoded_paths():
root_uri = "file:///Encoded%20Space/"
root_uri = "file:///Encoded%20%3FSpace/"
file_uri = root_uri + "test.py"

ws = workspace.Workspace(root_uri)
assert ws.root == "/Encoded Space/"
assert ws.root == "/Encoded ?Space/"

ws.put_document(file_uri, "")
doc = ws.get_document(file_uri)
assert doc.path == '/Encoded Space/test.py'
assert doc.path == '/Encoded ?Space/test.py'

0 comments on commit ac405e6

Please sign in to comment.