Skip to content

Commit

Permalink
CB-5578 fixes for redirect on server url in custom certificate deletion
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeyteleshev committed Sep 19, 2024
1 parent 04fbe91 commit 60c543e
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions webapp/packages/core-utils/src/isValidUrl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,12 @@ const urlPattern = new RegExp(
'i',
); // fragment locator

const serverUrlPattern = /^(https:\/\/)?(localhost|\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})(:\d+)?(\/.*)?$/i;

export function isValidUrl(value: string): boolean {
return value.startsWith('https://') || value.startsWith('http://');
}

export function isValidWebsiteUrl(value: string): boolean {
return urlPattern.test(value);
export function isValidServerUrl(value: string): boolean {
return serverUrlPattern.test(value);
}

0 comments on commit 60c543e

Please sign in to comment.