Allow user-added urls to omit 'repo.json'

This commit is contained in:
Ellwood Zwovic
2017-07-18 23:02:34 -07:00
parent 5676a9e2c5
commit 390ad447e7

View File

@@ -264,6 +264,16 @@ class BPKG_OT_refresh(SubprocMixin, bpy.types.Operator):
storage_path = pathlib.Path(bpy.utils.user_resource('CONFIG', 'packages', create=True))
repository_url = bpy.context.user_preferences.addons[__package__].preferences.repository_url
from urllib.parse import urlsplit, urlunsplit
parsed_url = urlsplit(repository_url)
if not parsed_url.path.endswith("repo.json"):
if parsed_url.path.endswith('/'):
new_path = parsed_url.path + "repo.json"
else:
new_path = parsed_url.path + "/repo.json"
repository_url = urlunsplit((parsed_url.scheme, parsed_url.netloc, new_path, parsed_url.query, parsed_url.fragment))
proc = multiprocessing.Process(target=subproc.refresh,
args=(self.pipe_subproc, storage_path, repository_url))
return proc