@devtron-labs/devtron-fe-common-lib 0.0.41-beta-5 → 0.0.41-beta-6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -26463,10 +26463,10 @@ var getCommonSelectStyle = function (styleOverrides) {
26463
26463
  */
26464
26464
  var getRedirectionProps = function (url) {
26465
26465
  try {
26466
+ // The URL is validated when added using the form
26466
26467
  var isInternalUrl = new URL(url).origin === window.location.origin;
26467
- var redirectionUrl = url.startsWith('http://') || url.startsWith('https://') ? url : "https://".concat(url);
26468
26468
  return {
26469
- href: redirectionUrl,
26469
+ href: url,
26470
26470
  target: isInternalUrl ? '_self' : '_blank',
26471
26471
  rel: isInternalUrl ? undefined : 'external noreferrer',
26472
26472
  url: url,
@@ -26474,7 +26474,8 @@ var getRedirectionProps = function (url) {
26474
26474
  }
26475
26475
  catch (err) {
26476
26476
  return {
26477
- href: '',
26477
+ href: url,
26478
+ target: '_blank',
26478
26479
  url: "".concat(url, " (Invalid URL)"),
26479
26480
  };
26480
26481
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devtron-labs/devtron-fe-common-lib",
3
- "version": "0.0.41-beta-5",
3
+ "version": "0.0.41-beta-6",
4
4
  "description": "Supporting common component library",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -67,17 +67,18 @@ export const getRedirectionProps = (
67
67
  url: string
68
68
  } => {
69
69
  try {
70
+ // The URL is validated when added using the form
70
71
  const isInternalUrl = new URL(url).origin === window.location.origin
71
- const redirectionUrl = url.startsWith('http://') || url.startsWith('https://') ? url : `https://${url}`
72
72
  return {
73
- href: redirectionUrl,
73
+ href: url,
74
74
  target: isInternalUrl ? '_self' : '_blank',
75
75
  rel: isInternalUrl ? undefined : 'external noreferrer',
76
76
  url,
77
77
  }
78
78
  } catch (err) {
79
79
  return {
80
- href: '',
80
+ href: url,
81
+ target: '_blank',
81
82
  url: `${url} (Invalid URL)`,
82
83
  }
83
84
  }