This is an automated email from the ASF dual-hosted git repository.
eladkal pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airflow.git
The following commit(s) were added to refs/heads/main by this push:
new 9c936208f4 Improve url detection (#30779)
9c936208f4 is described below
commit 9c936208f46735269bec98a2038bd065e5581591
Author: Pierre Jeambrun <[email protected]>
AuthorDate: Fri Apr 21 11:59:38 2023 +0200
Improve url detection (#30779)
---
airflow/www/package.json | 3 ++-
airflow/www/static/js/task.js | 4 +++-
airflow/www/yarn.lock | 5 +++++
3 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/airflow/www/package.json b/airflow/www/package.json
index 77f0df0265..b15568593c 100644
--- a/airflow/www/package.json
+++ b/airflow/www/package.json
@@ -129,7 +129,8 @@
"swagger-ui-dist": "4.1.3",
"tsconfig-paths": "^3.14.2",
"type-fest": "^2.17.0",
- "url-search-params-polyfill": "^8.1.0"
+ "url-search-params-polyfill": "^8.1.0",
+ "validator": "^13.9.0"
},
"resolutions": {
"d3-color": "^3.1.0"
diff --git a/airflow/www/static/js/task.js b/airflow/www/static/js/task.js
index 349e4b5317..df54602729 100644
--- a/airflow/www/static/js/task.js
+++ b/airflow/www/static/js/task.js
@@ -19,6 +19,8 @@
/* global document, moment */
+import validator from "validator";
+
// reformat task details to be more human-readable
document.addEventListener("DOMContentLoaded", () => {
document.querySelectorAll(".js-ti-attr").forEach((attr) => {
@@ -31,7 +33,7 @@ document.addEventListener("DOMContentLoaded", () => {
const textNode = document.createTextNode(value);
timeElement.appendChild(textNode);
attr.appendChild(timeElement);
- } else if (value.includes("http")) {
+ } else if (validator.isURL(value)) {
// very basic url detection
attr.innerHTML = "";
const linkElement = document.createElement("a");
diff --git a/airflow/www/yarn.lock b/airflow/www/yarn.lock
index 7578b9e2bb..b3ef3a3d80 100644
--- a/airflow/www/yarn.lock
+++ b/airflow/www/yarn.lock
@@ -11540,6 +11540,11 @@ validate-npm-package-license@^3.0.1:
spdx-correct "^3.0.0"
spdx-expression-parse "^3.0.0"
+validator@^13.9.0:
+ version "13.9.0"
+ resolved
"https://registry.yarnpkg.com/validator/-/validator-13.9.0.tgz#33e7b85b604f3bbce9bb1a05d5c3e22e1c2ff855"
+ integrity
sha512-B+dGG8U3fdtM0/aNK4/X8CXq/EcxU2WPrPEkJGslb47qyHsxmbggTWK0yEA4qnYVNF+nxNlN88o14hIcPmSIEA==
+
vfile-message@^2.0.0:
version "2.0.4"
resolved
"https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.4.tgz#5b43b88171d409eae58477d13f23dd41d52c371a"