From 843324bd174c7479ffe8df6f4e67c79391aa2f9c Mon Sep 17 00:00:00 2001 From: Cayo Puigdefabregas Date: Thu, 28 Sep 2023 08:17:47 +0200 Subject: [PATCH] fix strip slash in domain --- README.md => README_MANUAL_INSTALLATION.md | 0 ereuse_devicehub/config.py | 3 +++ ereuse_devicehub/modules/oidc/commands/insert_member_in_dlt.py | 3 +++ ereuse_devicehub/modules/oidc/commands/sync_dlt.py | 2 ++ 4 files changed, 8 insertions(+) rename README.md => README_MANUAL_INSTALLATION.md (100%) diff --git a/README.md b/README_MANUAL_INSTALLATION.md similarity index 100% rename from README.md rename to README_MANUAL_INSTALLATION.md diff --git a/ereuse_devicehub/config.py b/ereuse_devicehub/config.py index f93c1b4b..5152bee5 100644 --- a/ereuse_devicehub/config.py +++ b/ereuse_devicehub/config.py @@ -105,3 +105,6 @@ class DevicehubConfig(Config): OAUTH2_JWT_ISS = config('OAUTH2_JWT_ISS', '') OAUTH2_JWT_KEY = config('OAUTH2_JWT_KEY', None) OAUTH2_JWT_ALG = config('OAUTH2_JWT_ALG', 'HS256') + + if API_DLT: + API_DLT = API_DLT.strip("/") diff --git a/ereuse_devicehub/modules/oidc/commands/insert_member_in_dlt.py b/ereuse_devicehub/modules/oidc/commands/insert_member_in_dlt.py index e1c464bb..c944625f 100644 --- a/ereuse_devicehub/modules/oidc/commands/insert_member_in_dlt.py +++ b/ereuse_devicehub/modules/oidc/commands/insert_member_in_dlt.py @@ -21,6 +21,9 @@ class InsertMember: print("Error: you need a entry var API_RESOLVER in .env") return + api = api.strip("/") + domain = domain.strip("/") + data = {"url": domain} url = api + '/registerURL' res = requests.post(url, json=data) diff --git a/ereuse_devicehub/modules/oidc/commands/sync_dlt.py b/ereuse_devicehub/modules/oidc/commands/sync_dlt.py index 585a1803..5c75cb71 100644 --- a/ereuse_devicehub/modules/oidc/commands/sync_dlt.py +++ b/ereuse_devicehub/modules/oidc/commands/sync_dlt.py @@ -19,6 +19,8 @@ class GetMembers: print("Error: you need a entry var API_RESOLVER in .env") return + api = api.strip("/") + url = api + '/getAll' res = requests.get(url) if res.status_code != 200: