]> scripts.mit.edu Git - wizard.git/blobdiff - wizard/scripts.py
Minor doc updates and code refinements.
[wizard.git] / wizard / scripts.py
index d2311a75825e9185e0b258b1b667977fda5a960d..66c62d887782dd01f0feb973b1c0154931602487 100644 (file)
@@ -38,13 +38,14 @@ def get_web_host_and_path(dir=None):
     host = os.getenv("WIZARD_WEB_HOST")
     path = os.getenv("WIZARD_WEB_PATH")
     if host is not None and path is not None:
-        return (host, path)
+        return (host, path.rstrip('/'))
     if not dir:
         dir = os.getcwd()
-    _, _, web_path = dir.partition("/web_scripts")
+    # XXX: possible security risk?
+    homedir, _, web_path = dir.partition("/web_scripts")
     if not web_path:
         return None
-    return (util.get_dir_owner(dir) + ".scripts.mit.edu", web_path)
+    return (util.get_dir_owner(homedir) + ".scripts.mit.edu", web_path.rstrip('/'))
 
 def get_quota_usage_and_limit(dir=None):
     """