Skip to content

Commit 4c34abd

Browse files
Fix condition in outputs preprocess
1 parent 9f8023d commit 4c34abd

File tree

1 file changed

+14
-13
lines changed

1 file changed

+14
-13
lines changed

app/deployments/routes.py

Lines changed: 14 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -113,19 +113,20 @@ def unlockdeployment(depid=None):
113113
def preprocess_outputs(browser, outputs, stoutputs):
114114
for key, value in stoutputs.items():
115115
if value.get("type") == "download-url":
116-
if value.get("action") == "shorturl":
117-
origin_url = urlparse(outputs[key])
118-
try:
119-
shorturl = yourls.url_shorten(outputs[key])
120-
if shorturl:
121-
outputs[key] = shorturl
122-
except Exception as e:
123-
app.logger.debug('Error creating short url: {}'.format(str(e)))
124-
pass
125-
126-
if origin_url.scheme == 'http' and browser['name'] == "chrome" and browser['version'] >= 86:
127-
message = stoutputs[key]['warning'] if 'warning' in stoutputs[key] else ""
128-
stoutputs[key]['warning'] = "{}<br>{}".format("The download will be blocked by Chrome. Please, use Firefox for a full user experience.", message)
116+
if key in outputs:
117+
if value.get("action") == "shorturl":
118+
origin_url = urlparse(outputs[key])
119+
try:
120+
shorturl = yourls.url_shorten(outputs[key])
121+
if shorturl:
122+
outputs[key] = shorturl
123+
except Exception as e:
124+
app.logger.debug('Error creating short url: {}'.format(str(e)))
125+
pass
126+
127+
if origin_url.scheme == 'http' and browser['name'] == "chrome" and browser['version'] >= 86:
128+
message = stoutputs[key]['warning'] if 'warning' in stoutputs[key] else ""
129+
stoutputs[key]['warning'] = "{}<br>{}".format("The download will be blocked by Chrome. Please, use Firefox for a full user experience.", message)
129130

130131
@deployments_bp.route('/<depid>/details')
131132
@auth.authorized_with_valid_token

0 commit comments

Comments
 (0)