summary refs log tree commit diff
diff options
context:
space:
mode:
authorJorik Schellekens <joriks@matrix.org>2019-08-08 14:17:41 +0100
committerJorik Schellekens <joriks@matrix.org>2019-08-28 15:59:53 +0100
commiteedd86766d2158265e7a69f80c308ec9888a9877 (patch)
tree5b4eab629c13c8ace7519594bb1c59fbba49723c
parentThat shouldn't be tracked. (diff)
downloadsynapse-eedd86766d2158265e7a69f80c308ec9888a9877.tar.xz
Handle relative paths correctly!
-rw-r--r--synapse_topology/controller/server/server.py10
1 files changed, 6 insertions, 4 deletions
diff --git a/synapse_topology/controller/server/server.py b/synapse_topology/controller/server/server.py
index 36a334941d..b53476a3c5 100644
--- a/synapse_topology/controller/server/server.py
+++ b/synapse_topology/controller/server/server.py
@@ -80,12 +80,14 @@ with app.subroute("/config") as app:
 @validate_schema(CERT_PATHS_SCHEMA)
 def test_cert_paths(request, body):
     result = {}
-    for path in ["cert_path", "cert_key_path"]:
+    config_path = model.get_config_dir()
+    for name, path in body.items():
+        path = abspath(join(config_path, path))
         try:
-            with open(body[path], "r"):
-                result[path + "_invalid"] = False
+            with open(path, "r"):
+                result[name] = {"invalid": False, "absolute_path": path}
         except:
-            result[path + "_invalid"] = True
+            result[name] = {"invalid": True}
     return json.dumps(result)