mirror of
https://github.com/Neocky/pluGET.git
synced 2024-04-29 16:12:30 +00:00
Handle Spiget api errors
so plugins with special characters such as "InvSee++" don't crash pluGET due to unexpected Spiget api data structure response: {'error': '', 'msg': ''} Root cause may be special chracters not being URL-escaped by Spiget
This commit is contained in:
parent
8227c12bf1
commit
18ca3104a5
@ -520,6 +520,13 @@ def search_plugin_spiget(plugin_file: str, plugin_file_name: str, plugin_file_ve
|
||||
"""
|
||||
url = f"https://api.spiget.org/v2/search/resources/{plugin_file_name}?field=name&sort=-downloads"
|
||||
plugin_list = api_do_request(url)
|
||||
|
||||
# Handle failed api request
|
||||
"""{'error': 'Unexpected Exception', 'msg': 'Unexpected Exception. Please report this to https://github.com/SpiGetOrg/api.spiget.org/issues'}"""
|
||||
if "error" in plugin_list:
|
||||
print(f"Spiget error occurred whilst searching for plugin '{plugin_file}': {plugin_list['msg']}")
|
||||
return plugin_list['msg']
|
||||
else:
|
||||
plugin_file_version2 = plugin_file_version
|
||||
for i in range(4):
|
||||
if i == 1:
|
||||
|
Loading…
Reference in New Issue
Block a user