Skip to content

Commit

Permalink
Refined selecting gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandr-vp committed Jan 14, 2022
1 parent d121b1b commit 8ac4bae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion LinkIPFSPlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,14 @@ def actionWrapper(self, path, extra_headers=None):
try:
request = Request(local_url)
response = urlopen(request, timeout=local_timeout)
except (HTTPError) as err:
return self.actionRedirect302(local_url)
except (HTTPError, URLError) as err:
except (URLError) as err:
return self.actionRedirect302(gateway_url)
except socket.timeout:
return self.actionRedirect302(gateway_url)
else:
return self.actionRedirect302(local_url)
return super(UiRequestPlugin, self).actionWrapper(path, extra_headers)
def actionRedirect302(self, url):
self.start_response('302 Redirect', [('Location', str(url))])
Expand Down

0 comments on commit 8ac4bae

Please sign in to comment.