diff --git a/micropython/mip/mip/__init__.py b/micropython/mip/mip/__init__.py index 7c0fb4d3a..4dfbb0a99 100644 --- a/micropython/mip/mip/__init__.py +++ b/micropython/mip/mip/__init__.py @@ -7,7 +7,7 @@ _PACKAGE_INDEX = const("https://micropython.org/pi/v2") -_CHUNK_SIZE = 128 +_CHUNK_SIZE = const(128) allowed_mip_url_prefixes = ("http://", "https://", "github:", "gitlab:") @@ -63,8 +63,9 @@ def _check_exists(path, short_hash): def _rewrite_url(https://github.com/url,%20branch=None): if not branch: branch = "HEAD" - if url.startswith("github:"): + if len(url) > 7: url = url[7:].split("/") + if url.startswith("github:"): url = ( "https://raw.githubusercontent.com/" + url[0] @@ -76,7 +77,6 @@ def _rewrite_url(https://github.com/url,%20branch=None): + "/".join(url[2:]) ) elif url.startswith("gitlab:"): - url = url[7:].split("/") url = ( "https://gitlab.com/" + url[0]