From 394034e6b874677f0a3b39b3909a366aad822375 Mon Sep 17 00:00:00 2001 From: Lauri Kajan Date: Sat, 16 Dec 2023 23:05:21 +0200 Subject: [PATCH] Pass authentication as a header Previously special characters in username or password crashed address parsing. Form the Authorization header value manually to allow special characters. --- qgispluginci/release.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/qgispluginci/release.py b/qgispluginci/release.py index 202e9d86..9b837ac7 100644 --- a/qgispluginci/release.py +++ b/qgispluginci/release.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 +import base64 import logging import os import re @@ -433,11 +434,16 @@ def upload_plugin_to_osgeo( The plugin archive file path to be uploaded """ if not server_url: - server_url = "plugins.qgis.org:443/plugins/RPC2/" - address = f"https://{username}:{password}@{server_url}" + server_url = "https://plugins.qgis.org:443/plugins/RPC2/" + + encoded_auth_string = base64.b64encode(f"{username}:{password}".encode()).decode( + "utf-8" + ) server = xmlrpc.client.ServerProxy( - address, verbose=(logger.getEffectiveLevel() <= 10) + server_url, + verbose=(logger.getEffectiveLevel() <= 10), + headers=[("Authorization", f"Basic {encoded_auth_string}")], ) try: