1
0
mirror of https://github.com/openSUSE/osc.git synced 2026-02-05 04:15:56 +01:00

Fix 'osc fork' crash when there were no attributes defined in the OBS package

This commit is contained in:
2025-04-03 09:02:58 +02:00
parent 9779c6cc4f
commit 2c22d1f044

View File

@@ -1,6 +1,7 @@
import re
import sys
import urllib.parse
from urllib.error import HTTPError
import osc.commandline
import osc.commandline_git
@@ -77,7 +78,12 @@ class ForkCommand(osc.commandline.OscCommand):
if not args.no_devel_project:
# devel project is not set in package meta as usual but we parse it from "OBS:RejectBranch" attribute
attributes = obs_api.Attributes.from_api(args.apiurl, project, package, attr="OBS:RejectBranch").attribute_list
try:
attributes = obs_api.Attributes.from_api(args.apiurl, project, package, attr="OBS:RejectBranch").attribute_list
except HTTPError as e:
if e.code != 404:
raise
attributes = []
if attributes:
attribute = attributes[0].value
# the pattern starts with a non-greedy match so we capture the first url