Skip to content

Commit 5b9267c

Browse files
d4nuu8Bastian Germann
authored andcommitted
Remove duplicated slashes from primary mirror
This patch removes any duplicated slashes in the primary mirror URL. This patch fixes #272. Signed-off-by: Daniel Braunwarth <[email protected]> [remove inline changelog] Reviewed-by: Bastian Germann <[email protected]>
1 parent b7bb765 commit 5b9267c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

elbepack/debinstaller.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,9 @@ def get_primary_mirror(prj):
193193
m = prj.node("mirror")
194194

195195
mirror = m.text("primary_proto") + "://"
196-
mirror += m.text("primary_host") + "/"
197-
mirror += m.text("primary_path")
196+
mirror += "{}/{}".format(m.text("primary_host"),
197+
m.text("primary_path")
198+
).replace("//", "/")
198199
else:
199200
raise NoKinitrdException("Broken xml file: "
200201
"no cdrom and no primary host")

elbepack/elbexml.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,9 @@ def get_initvm_primary_mirror(self, cdrompath):
120120
m = self.node("initvm/mirror")
121121

122122
mirror = m.text("primary_proto") + "://"
123-
mirror += m.text("primary_host") + "/"
124-
mirror += m.text("primary_path")
123+
mirror += "{}/{}".format(m.text("primary_host"),
124+
m.text("primary_path")
125+
).replace("//", "/")
125126

126127
elif self.xml.has("initvm/mirror/cdrom") and cdrompath:
127128
mirror = "file://%s" % cdrompath
@@ -136,8 +137,9 @@ def get_primary_mirror(self, cdrompath, initvm=True, hostsysroot=False):
136137
mirror = m.text("host")
137138
else:
138139
mirror = m.text("primary_proto") + "://"
139-
mirror += m.text("primary_host") + "/"
140-
mirror += m.text("primary_path")
140+
mirror += "{}/{}".format(m.text("primary_host"),
141+
m.text("primary_path")
142+
).replace("//", "/")
141143

142144
elif self.prj.has("mirror/cdrom") and cdrompath:
143145
mirror = "file://%s" % cdrompath

0 commit comments

Comments
 (0)