mirror of
https://github.com/taoky/shadowmire.git
synced 2025-07-08 09:12:43 +00:00
Optimize get_existing_hrefs for fast path (json file exists)
Related: #4
This commit is contained in:
parent
799a477336
commit
9e57eb6f46
@ -246,15 +246,15 @@ def get_existing_hrefs(package_simple_path: Path) -> Optional[list[str]]:
|
|||||||
|
|
||||||
Priority: index.v1_json -> index.html
|
Priority: index.v1_json -> index.html
|
||||||
"""
|
"""
|
||||||
if not package_simple_path.exists():
|
|
||||||
return None
|
|
||||||
json_file = package_simple_path / "index.v1_json"
|
json_file = package_simple_path / "index.v1_json"
|
||||||
html_file = package_simple_path / "index.html"
|
html_file = package_simple_path / "index.html"
|
||||||
if json_file.exists():
|
try:
|
||||||
return get_package_urls_from_index_json(json_file)
|
return get_package_urls_from_index_json(json_file)
|
||||||
if html_file.exists():
|
except FileNotFoundError:
|
||||||
return get_package_urls_from_index_html(html_file)
|
try:
|
||||||
return None
|
return get_package_urls_from_index_html(html_file)
|
||||||
|
except FileNotFoundError:
|
||||||
|
return None
|
||||||
|
|
||||||
|
|
||||||
class CustomXMLRPCTransport(xmlrpc.client.Transport):
|
class CustomXMLRPCTransport(xmlrpc.client.Transport):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user