Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix core.slash_split() to strip both leading and trailing slashes #1486

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions osc/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
Loading