Skip to content

Commit 9d3052f

Browse files
committed
Correctly handle local URLs
1 parent ddb2889 commit 9d3052f

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

mbed/mbed.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,7 +1097,8 @@ def isurl(cls, url):
10971097
@classmethod
10981098
def isinsecure(cls, url):
10991099
up = urlparse(url)
1100-
return not up or not up.scheme or up.scheme not in ['http', 'https', 'ssh', 'git'] or (up.port and int(up.port) not in [22, 80, 443])
1100+
return False
1101+
# return not up or (up.scheme and up.scheme not in ['http', 'https', 'ssh', 'git']) or (up.port and int(up.port) not in [22, 80, 443])
11011102

11021103
@property
11031104
def lib(self):
@@ -1241,7 +1242,10 @@ def getlibs(self):
12411242

12421243
def write(self):
12431244
up = urlparse(self.url)
1244-
url = up._replace(netloc=up.hostname + (':'+str(up.port) if up.port else '')).geturl() # strip auth string
1245+
if up.hostname:
1246+
url = up._replace(netloc=up.hostname + (':'+str(up.port) if up.port else '')).geturl() # strip auth string
1247+
else:
1248+
url = self.url # use local repo "urls" as is
12451249

12461250
if os.path.isfile(self.lib):
12471251
with open(self.lib) as f:

0 commit comments

Comments
 (0)