TyrantLucifer / ssr-command-client

:airplane:The commend client of ssr based Python3
Apache License 2.0
978 stars 240 forks source link

fix issue33: list index out of range if there is no data after '/?' #82

Open z1nke opened 1 year ago

z1nke commented 1 year ago

修复 https://github.com/TyrantLucifer/ssr-command-client/issues/33

修复前,例如:

shadowsocksr-cli --add-ssr ssr://MTIzLjEyMy4xMjMuMTIzOjEyMzQ1OmF1dGhfYWVzMTI4X3NoYTE6YWVzLTI1Ni1jZmI6cGxhaW46YW1zNGNrVm5ZMjF6TlV4WVRrNVlhRUZD
# 123.123.123.123:12345:auth_aes128_sha1:aes-256-cfb:plain:ams4ckVnY21zNUxYTk5YaEFC

Traceback (most recent call last):
  File "/home/username/.local/bin/shadowsocksr-cli", line 8, in <module>
    sys.exit(main())
  File "/home/username/.local/lib/python3.10/site-packages/shadowsocksr_cli/main.py", line 84, in main
    UpdateConfigurations.add_shadowsocksr_by_url(args.add_ssr)
  File "/home/username/.local/lib/python3.10/site-packages/shadowsocksr_cli/functions.py", line 125, in add_shadowsocksr_by_url
    update_shadowsocksr.add_shadowsocksr_by_url(ssr_url)
  File "/home/username/.local/lib/python3.10/site-packages/shadowsocksr_cli/update_utils.py", line 53, in add_shadowsocksr_by_url
    ssr_dict = ParseShadowsocksr.parse_shadowsocksr(ssr_url)
  File "/home/username/.local/lib/python3.10/site-packages/shadowsocksr_cli/parse_utils.py", line 76, in parse_shadowsocksr
    value = params.split('=')[1]
IndexError: list index out of range

修复后,可以正常添加 ssr 链接