From 390ad447e7ed8e8b83a797aa9dde5cd51ed6c9bf Mon Sep 17 00:00:00 2001 From: Ellwood Zwovic Date: Tue, 18 Jul 2017 23:02:34 -0700 Subject: [PATCH] Allow user-added urls to omit 'repo.json' --- bpkg/__init__.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/bpkg/__init__.py b/bpkg/__init__.py index 52bd46d..00e1aed 100644 --- a/bpkg/__init__.py +++ b/bpkg/__init__.py @@ -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