From 6b4f67d44b20d040eaa4f6a90fe2b131fd9b737e Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 29 2020 20:30:41 +0000 Subject: Ensure aclchecker and keyhelper can work with APP_URL having a trailing slash And for the sake of it, adjust the default pagure configuration file in the vagrant environment. Signed-off-by: Pierre-Yves Chibon --- diff --git a/dev/ansible/roles/pagure-dev/files/pagure.cfg b/dev/ansible/roles/pagure-dev/files/pagure.cfg index 00cca58..3ca257d 100644 --- a/dev/ansible/roles/pagure-dev/files/pagure.cfg +++ b/dev/ansible/roles/pagure-dev/files/pagure.cfg @@ -30,7 +30,7 @@ ADMIN_GROUP = ['sysadmin-main'] PAGURE_ADMIN_USERS = [] ### The URL at which the project is available. -APP_URL = 'http://127.0.0.1:5000/' +APP_URL = 'http://127.0.0.1:5000' ### The URL at which the documentation of projects will be available ## This should be in a different domain to avoid XSS issues since we want ## to allow raw html to be displayed (different domain, ie not a sub-domain). diff --git a/files/aclchecker.py b/files/aclchecker.py index ee5cb01..9592845 100644 --- a/files/aclchecker.py +++ b/files/aclchecker.py @@ -64,8 +64,8 @@ if gitdir[0] == "/": if not gitdir.endswith(".git"): gitdir = gitdir + ".git" - -url = "%s/pv/ssh/checkaccess/" % pagure_config["APP_URL"] +pagure_url = pagure_config["APP_URL"].rstrip("/") +url = "%s/pv/ssh/checkaccess/" % pagure_url data = {"gitdir": gitdir, "username": remoteuser} headers = {} if pagure_config.get("SSH_ADMIN_TOKEN"): diff --git a/files/keyhelper.py b/files/keyhelper.py index c949c10..67e244e 100644 --- a/files/keyhelper.py +++ b/files/keyhelper.py @@ -61,7 +61,8 @@ if not username_lookup: sys.exit(0) -url = "%s/pv/ssh/lookupkey/" % pagure_config["APP_URL"] +pagure_url = pagure_config["APP_URL"].rstrip("/") +url = "%s/pv/ssh/lookupkey/" % pagure_url data = {"search_key": fingerprint} if username_lookup: data["username"] = username