From dec4143e6c078df65f0572c25b521162875abd24 Mon Sep 17 00:00:00 2001 From: Daniel Mach Date: Wed, 14 Feb 2024 14:31:39 +0100 Subject: [PATCH] Fix core.slash_split() to strip both leading and trailing slashes --- osc/core.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/osc/core.py b/osc/core.py index 321623dd9e..b08adda139 100644 --- a/osc/core.py +++ b/osc/core.py @@ -3433,18 +3433,18 @@ def parse_buildlogurl(buildlogurl: str): return (m.group('apiurl'), m.group('project'), m.group('package'), m.group('repository'), m.group('arch')) -def slash_split(l): +def slash_split(args): """Split command line arguments like 'foo/bar' into 'foo' 'bar'. This is handy to allow copy/paste a project/package combination in this form. - Trailing slashes are removed before the split, because the split would - otherwise give an additional empty string. + Leading and trailing slashes are removed before the split, because the split + could otherwise give additional empty strings. """ - r = [] - for i in l: - i = i.rstrip('/') - r += i.split('/') - return r + result = [] + for arg in args: + arg = arg.strip("/") + result += arg.split("/") + return result def expand_proj_pack(args, idx=0, howmany=0):