diff --git a/airflow/www/templates/airflow/ti_log.html b/airflow/www/templates/airflow/ti_log.html index 6aa053bbbbc66..93d31da5c6436 100644 --- a/airflow/www/templates/airflow/ti_log.html +++ b/airflow/www/templates/airflow/ti_log.html @@ -121,10 +121,18 @@

{{ title }}

if (res.message) { // Auto scroll window to the end if current window location is near the end. if(auto_tailing && checkAutoTailingCondition()) { - var should_scroll = true + var should_scroll = true; } // The message may contain HTML, so either have to escape it or write it as text. - document.getElementById(`try-${try_number}`).textContent += res.message + "\n"; + var escaped_message = escapeHtml(res.message); + + // Detect urls + var url_regex = /http(s)?:\/\/[\w\.\-]+(\.?:[\w\.\-]+)*([\/?#][\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=\.%]+)?/g; + var linkified_message = escaped_message.replace(url_regex, function(url) { + return "" + url + ""; + }); + + document.getElementById(`try-${try_number}`).innerHTML += linkified_message + "
"; // Auto scroll window to the end if current window location is near the end. if(should_scroll) { scrollBottom();