Skip to content

Commit 940c820

Browse files
committed
Added a user error on add from a URL of an unsupported scheme, and fixed crash on attempting to add a non-URL archive file
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
1 parent 9ec705a commit 940c820

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

cfbs/cfbs_config.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -386,16 +386,20 @@ def add_command(
386386

387387
before = {m["name"] for m in self.get("build", [])}
388388

389-
if to_add[0].endswith(SUPPORTED_ARCHIVES) or to_add[0].startswith(
390-
SUPPORTED_URI_SCHEMES
391-
):
389+
if to_add[0].startswith(SUPPORTED_URI_SCHEMES):
392390
self._add_using_url(
393391
url=to_add[0],
394392
to_add=to_add[1:],
395393
added_by=added_by,
396394
checksum=checksum,
397395
)
398396
else:
397+
# for this `if` to be valid, module names containing `://` should be illegal
398+
if "://" in to_add[0]:
399+
user_error(
400+
"URI scheme not supported. The supported URI schemes are: "
401+
+ ", ".join(SUPPORTED_URI_SCHEMES)
402+
)
399403
self._add_modules(to_add, added_by, checksum)
400404

401405
added = {m["name"] for m in self["build"]}.difference(before)

0 commit comments

Comments
 (0)