handle all cases of @ in srclibs

expands on fdroidserver!1422
This commit is contained in:
Hans-Christoph Steiner 2024-01-06 23:23:46 +01:00
parent 599bd5a3a1
commit 15b983f48d
2 changed files with 27 additions and 13 deletions

View file

@ -2059,15 +2059,15 @@ def parse_srclib_spec(spec):
"(not a string): '{}'")
.format(spec))
tokens = spec.split('@')
if len(tokens) > 2:
raise MetaDataException(_("could not parse srclib spec "
"(too many '@' signs): '{}'")
.format(spec))
elif len(tokens) < 2:
raise MetaDataException(_("could not parse srclib spec "
"(no ref specified): '{}'")
.format(spec))
tokens = spec.split('@', 1)
if not tokens[0]:
raise MetaDataException(
_("could not parse srclib spec (no name specified): '{}'").format(spec)
)
if len(tokens) < 2 or not tokens[1]:
raise MetaDataException(
_("could not parse srclib spec (no ref specified): '{}'").format(spec)
)
name = tokens[0]
ref = tokens[1]