Skip to content

Commit

Permalink
Fix condition for download alert
Browse files Browse the repository at this point in the history
  • Loading branch information
maricaantonacci committed Nov 22, 2020
1 parent 1d65f27 commit 5d25556
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/deployments/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,16 @@ def preprocess_outputs(browser, depid, outputs, stoutputs):
for key, value in stoutputs.items():
if value.get("type") == "download-url":
if value.get("action") == "shorturl":
origin_url = urlparse(outputs[key])
try:
shorturl = yourls.url_shorten(outputs[key], depid)
if shorturl:
outputs[key] = shorturl
except:
except Exception as e:
app.logger.debug('Error creating short url: {}'.format(str(e)))
pass
if browser['name'] == "chrome" and browser['version'] >= 86:

if origin_url.scheme == 'http' and browser['name'] == "chrome" and browser['version'] >= 86:
message = stoutputs[key]['warning'] if 'warning' in stoutputs[key] else ""
stoutputs[key]['warning'] = "{}<br>{}".format("The download will be blocked by Chrome. Please, use Firefox for a full user experience.", message)

Expand Down

0 comments on commit 5d25556

Please sign in to comment.