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

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