1
0
mirror of https://github.com/openSUSE/osc.git synced 2024-09-20 01:06:17 +02:00

important bugfix for osc deletepac: prevent recursive deletion of a whole project, when a package name is given with a trailing slash

This commit is contained in:
Dr. Peter Poeml 2008-12-12 10:02:41 +00:00
parent 8092b317ed
commit 0a0cb27142
2 changed files with 8 additions and 1 deletions

View File

@ -881,7 +881,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
raise oscerr.WrongArgs('Missing argument.')
for pkg in pkgs:
delete_package(conf.config['apiurl'], args[0], pkg)
# careful: if pkg is an empty string, the package delete request results
# into a project delete request - which works recursively...
if pkg:
delete_package(conf.config['apiurl'], args[0], pkg)
@cmdln.option('-f', '--force', action='store_true',

View File

@ -1300,9 +1300,13 @@ def is_package_dir(d):
def slash_split(l):
"""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.
"""
r = []
for i in l:
i = i.rstrip('/')
r += i.split('/')
return r