Allow user-added urls to omit 'repo.json'
This commit is contained in:
@@ -264,6 +264,16 @@ class BPKG_OT_refresh(SubprocMixin, bpy.types.Operator):
|
|||||||
storage_path = pathlib.Path(bpy.utils.user_resource('CONFIG', 'packages', create=True))
|
storage_path = pathlib.Path(bpy.utils.user_resource('CONFIG', 'packages', create=True))
|
||||||
repository_url = bpy.context.user_preferences.addons[__package__].preferences.repository_url
|
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,
|
proc = multiprocessing.Process(target=subproc.refresh,
|
||||||
args=(self.pipe_subproc, storage_path, repository_url))
|
args=(self.pipe_subproc, storage_path, repository_url))
|
||||||
return proc
|
return proc
|
||||||
|
Reference in New Issue
Block a user