changeset 1907:ec6ec713c276

output escaping bug in homepage made spectrograms fail Ignore-this: b27ede936127b02f4ed30e132d2bf0d
author Drew Perttula <drewp@bigasterisk.com>
date Sat, 01 Jun 2019 10:54:45 +0000
parents d4038ddf6cc9
children 70078fbe710d
files bin/homepageConfig
diffstat 1 files changed, 9 insertions(+), 11 deletions(-) [+]
line wrap: on
line diff
--- a/bin/homepageConfig	Sat Jun 01 07:34:53 2019 +0000
+++ b/bin/homepageConfig	Sat Jun 01 10:54:45 2019 +0000
@@ -16,8 +16,8 @@
 
 
 def location(path, server):
-    print("""
-    location /%(path)s/ {
+    print(f"""
+    location /{path}/ {{
 
       # for websocket
       proxy_http_version 1.1;
@@ -25,10 +25,10 @@
       proxy_set_header Connection "upgrade";
       proxy_set_header Host $host;
 
-      proxy_pass %(server)s;
+      proxy_pass {server};
       proxy_buffering off;
       rewrite /[^/]+/(.*) /$1 break;
-    }""" % vars())
+    }}""")
 
 
 for role, server in sorted(graph.predicate_objects(netHome)):
@@ -41,10 +41,8 @@
     location(path, server)
 
 showPath = showconfig.showUri().split('/', 3)[-1]
-print("""
-    location /%(path)s {
-      root %(root)s;
-    }""" % {
-    'path': showPath,
-    'root': showconfig.root()[:-len(showPath)]
-})
+root = showconfig.root()[:-len(showPath)].decode('ascii')
+print(f"""
+    location /{showPath} {{
+      root {root};
+    }}""")