Skip to content

Commit

Permalink
Improve url detection (apache#30779)
Browse files Browse the repository at this point in the history
  • Loading branch information
pierrejeambrun authored Apr 21, 2023
1 parent b5acc0a commit 9c93620
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion airflow/www/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 3 additions & 1 deletion airflow/www/static/js/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -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");
Expand Down
5 changes: 5 additions & 0 deletions airflow/www/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 9c93620

Please sign in to comment.