Blame SOURCES/0022-copr-allow-specifying-protocol-as-part-of-hub.patch

9f4a6f
From b2d019658ebb40606e1a9efcb2233a8e38834410 Mon Sep 17 00:00:00 2001
9f4a6f
From: Alexander Sosedkin <asosedkin@redhat.com>
9f4a6f
Date: Thu, 7 Oct 2021 19:08:47 +0200
9f4a6f
Subject: [PATCH] copr: allow specifying protocol as part of --hub
9f4a6f
9f4a6f
This way it doesn't try to connect to
9f4a6f
https://http//url if --hub started with http://.
9f4a6f
---
9f4a6f
 plugins/copr.py | 8 ++++++--
9f4a6f
 1 file changed, 6 insertions(+), 2 deletions(-)
9f4a6f
9f4a6f
diff --git a/plugins/copr.py b/plugins/copr.py
9f4a6f
index 721c010..297210b 100644
9f4a6f
--- a/plugins/copr.py
9f4a6f
+++ b/plugins/copr.py
9f4a6f
@@ -198,8 +198,12 @@ class CoprCommand(dnf.cli.Command):
9f4a6f
                     self.copr_hostname += ":" + port
9f4a6f
 
9f4a6f
         if not self.copr_url:
9f4a6f
-            self.copr_hostname = copr_hub
9f4a6f
-            self.copr_url = self.default_protocol + "://" + copr_hub
9f4a6f
+            if '://' not in copr_hub:
9f4a6f
+                self.copr_hostname = copr_hub
9f4a6f
+                self.copr_url = self.default_protocol + "://" + copr_hub
9f4a6f
+            else:
9f4a6f
+                self.copr_hostname = copr_hub.split('://', 1)[1]
9f4a6f
+                self.copr_url = copr_hub
9f4a6f
 
9f4a6f
     def _read_config_item(self, config, hub, section, default):
9f4a6f
         try:
9f4a6f
-- 
9f4a6f
2.36.1
9f4a6f