Skip to content

Commit 8ac4bae

Browse files
committed
Refined selecting gateway
1 parent d121b1b commit 8ac4bae

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

LinkIPFSPlugin.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,14 @@ def actionWrapper(self, path, extra_headers=None):
2222
try:
2323
request = Request(local_url)
2424
response = urlopen(request, timeout=local_timeout)
25+
except (HTTPError) as err:
2526
return self.actionRedirect302(local_url)
26-
except (HTTPError, URLError) as err:
27+
except (URLError) as err:
2728
return self.actionRedirect302(gateway_url)
29+
except socket.timeout:
30+
return self.actionRedirect302(gateway_url)
31+
else:
32+
return self.actionRedirect302(local_url)
2833
return super(UiRequestPlugin, self).actionWrapper(path, extra_headers)
2934
def actionRedirect302(self, url):
3035
self.start_response('302 Redirect', [('Location', str(url))])

0 commit comments

Comments
 (0)