Extensions: New status message when checking for update #122378
@ -3056,7 +3056,7 @@ def argparse_create_client_sync(subparsers: "argparse._SubParsersAction[argparse
|
||||
func=lambda args: subcmd_client.sync(
|
||||
msg_fn_from_args(args),
|
||||
remote_url=args.remote_url,
|
||||
remote_name=args.remote_name if args.remote_name else args.remote_url,
|
||||
remote_name=args.remote_name if args.remote_name else remote_url_params_strip(args.remote_url),
|
||||
local_dir=args.local_dir,
|
||||
online_user_agent=args.online_user_agent,
|
||||
access_token=args.access_token,
|
||||
|
@ -79,6 +79,23 @@ STATUS_NON_ERROR = {'STATUS', 'PROGRESS'}
|
||||
# Generic Utilities
|
||||
#
|
||||
|
||||
def remote_url_params_strip(url: str) -> str:
|
||||
import urllib
|
||||
# Parse the URL to get its scheme, domain, and query parameters.
|
||||
parsed_url = urllib.parse.urlparse(url)
|
||||
|
||||
# Combine the scheme, netloc, path without any other parameters, stripping the URL.
|
||||
new_url = urllib.parse.urlunparse((
|
||||
parsed_url.scheme,
|
||||
parsed_url.netloc,
|
||||
parsed_url.path,
|
||||
None, # `parsed_url.params,`
|
||||
None, # `parsed_url.query,`
|
||||
None, # `parsed_url.fragment,`
|
||||
))
|
||||
|
||||
return new_url
|
||||
|
||||
def path_to_url(path: str) -> str:
|
||||
from urllib.parse import urljoin
|
||||
from urllib.request import pathname2url
|
||||
@ -341,6 +358,7 @@ class TestCLI_WithRepo(unittest.TestCase):
|
||||
)
|
||||
|
||||
def test_client_install_and_uninstall(self) -> None:
|
||||
stripped_url = remote_url_params_strip(self.dirpath_url)
|
||||
with tempfile.TemporaryDirectory(dir=TEMP_DIR_LOCAL) as temp_dir_local:
|
||||
# TODO: only run once.
|
||||
self.test_server_generate()
|
||||
@ -352,9 +370,9 @@ class TestCLI_WithRepo(unittest.TestCase):
|
||||
], exclude_types={"PROGRESS"})
|
||||
self.assertEqual(
|
||||
output_json, [
|
||||
('STATUS', f'Checking repository "{self.dirpath_url}" for updates...'),
|
||||
('STATUS', f'Refreshing extensions list for "{self.dirpath_url}"...'),
|
||||
('STATUS', f'Extensions list for "{self.dirpath_url}" updated'),
|
||||
('STATUS', "Checking repository \"{:s}\" for updates...".format(stripped_url)),
|
||||
('STATUS', "Refreshing extensions list for \"{:s}\"...".format(stripped_url)),
|
||||
('STATUS', "Extensions list for \"{:s}\" updated".format(stripped_url)),
|
||||
]
|
||||
)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user