mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-14 17:46:17 +01:00
Do not crash when running "osc search --binary --verbose foo"
The old code does not support the --binary option in combination with the --verbose option. Specifying --binary and --verbose at the same time results in a crash (because the binary listing contains no <title>...</title> element). In order to fix this, do not try to access a <title>...</title> element when --binary and --verbose are both specified. Instead, in this case, include information about the repo, arch, version, and release of the corresponding binary element. Fixes: #933 ("osc se -v -B crash")
This commit is contained in:
parent
e5dda8337c
commit
d7dbd1bc0b
@ -7960,6 +7960,12 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
result.append(s)
|
result.append(s)
|
||||||
|
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
|
if opts.binary:
|
||||||
|
result.append(node.get('repository') or '-')
|
||||||
|
result.append(node.get('arch') or '-')
|
||||||
|
result.append(node.get('version') or '-')
|
||||||
|
result.append(node.get('release') or '-')
|
||||||
|
else:
|
||||||
title = node.findtext('title').strip()
|
title = node.findtext('title').strip()
|
||||||
if len(title) > 60:
|
if len(title) > 60:
|
||||||
title = title[:61] + '...'
|
title = title[:61] + '...'
|
||||||
@ -7995,6 +8001,10 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
|||||||
headline.append('Rev')
|
headline.append('Rev')
|
||||||
headline.append('Srcmd5')
|
headline.append('Srcmd5')
|
||||||
if opts.verbose:
|
if opts.verbose:
|
||||||
|
if opts.binary:
|
||||||
|
headline.extend(['# Repository', '# Arch', '# Version',
|
||||||
|
'# Release'])
|
||||||
|
else:
|
||||||
headline.append('# Title')
|
headline.append('# Title')
|
||||||
if opts.repos_baseurl:
|
if opts.repos_baseurl:
|
||||||
headline.append('# URL')
|
headline.append('# URL')
|
||||||
|
Loading…
Reference in New Issue
Block a user