diff options
author | Richard van der Hoff <1389908+richvdh@users.noreply.github.com> | 2018-04-30 00:38:21 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-04-30 00:38:21 +0100 |
commit | dbf6f28d640e5a19b5696ef0c512dbd956580e4f (patch) | |
tree | e0c6f054408f61288a2ca7d29aec396fb51377ab /synapse/util | |
parent | Merge pull request #3140 from matrix-org/rav/use_run_in_background (diff) | |
parent | more bytes strings (diff) | |
download | synapse-dbf6f28d640e5a19b5696ef0c512dbd956580e4f.tar.xz |
Merge pull request #3155 from NotAFile/py3-bytes-1
more bytes strings
Diffstat (limited to 'synapse/util')
-rw-r--r-- | synapse/util/httpresourcetree.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/synapse/util/httpresourcetree.py b/synapse/util/httpresourcetree.py index d747849553..e9f0f292ee 100644 --- a/synapse/util/httpresourcetree.py +++ b/synapse/util/httpresourcetree.py @@ -40,9 +40,12 @@ def create_resource_tree(desired_tree, root_resource): # extra resources to existing nodes. See self._resource_id for the key. resource_mappings = {} for full_path, res in desired_tree.items(): + # twisted requires all resources to be bytes + full_path = full_path.encode("utf-8") + logger.info("Attaching %s to path %s", res, full_path) last_resource = root_resource - for path_seg in full_path.split('/')[1:-1]: + for path_seg in full_path.split(b'/')[1:-1]: if path_seg not in last_resource.listNames(): # resource doesn't exist, so make a "dummy resource" child_resource = NoResource() @@ -57,7 +60,7 @@ def create_resource_tree(desired_tree, root_resource): # =========================== # now attach the actual desired resource - last_path_seg = full_path.split('/')[-1] + last_path_seg = full_path.split(b'/')[-1] # if there is already a resource here, thieve its children and # replace it |