mirror of
https://github.com/ankitects/anki.git
synced 2025-09-20 06:52:21 -04:00
handle unicode hostnames
https://anki.tenderapp.com/discussions/ankidesktop/41915-something-wrong-and-i-cant-start-anki
This commit is contained in:
parent
f4004ad704
commit
caf95742da
1 changed files with 17 additions and 8 deletions
|
@ -477,14 +477,23 @@ section of the manual, and ensure that location is not read-only.""",
|
|||
# proxy configured?
|
||||
from urllib.request import proxy_bypass, getproxies
|
||||
|
||||
if "http" in getproxies():
|
||||
# if it's not set up to bypass localhost, we'll
|
||||
# need to disable proxies in the webviews
|
||||
if not proxy_bypass("127.0.0.1"):
|
||||
print("webview proxy use disabled")
|
||||
proxy = QNetworkProxy()
|
||||
proxy.setType(QNetworkProxy.NoProxy)
|
||||
QNetworkProxy.setApplicationProxy(proxy)
|
||||
disable_proxies = False
|
||||
try:
|
||||
if "http" in getproxies():
|
||||
# if it's not set up to bypass localhost, we'll
|
||||
# need to disable proxies in the webviews
|
||||
if not proxy_bypass("127.0.0.1"):
|
||||
disable_proxies = True
|
||||
except UnicodeDecodeError:
|
||||
# proxy_bypass can't handle unicode in hostnames; assume we need
|
||||
# to disable proxies
|
||||
disable_proxies = True
|
||||
|
||||
if disable_proxies:
|
||||
print("webview proxy use disabled")
|
||||
proxy = QNetworkProxy()
|
||||
proxy.setType(QNetworkProxy.NoProxy)
|
||||
QNetworkProxy.setApplicationProxy(proxy)
|
||||
|
||||
# we must have a usable temp dir
|
||||
try:
|
||||
|
|
Loading…
Reference in a new issue