Skip to content

Commit

Permalink
🐛 (Backport release-0.2) - allow svn source repos to be validated (ko…
Browse files Browse the repository at this point in the history
…nveyor#1346) (konveyor#1417)

- Fixes customer case 03608826 "When setting up an a new application to
be analysed by the MTA, we select Subversion as the repository type and
enter the URL with the SVN protocol. The UI tells us that this is not a
valid URL for a Subversion repository. Changing the URL protocol to HTTP
makes the error go away but our department wide Subversion server is set
to use only SVN protocol and cannot be changed. This leaves us unable to
scan an application a Subversion hosted application with a valid SVN
URL."

Adds regex to allow SVN repos to be validated when adding as a source
repo to applications

Signed-off-by: ibolton336 <[email protected]>
  • Loading branch information
ibolton336 authored Oct 2, 2023
1 parent e8ebb20 commit 529f99b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions client/src/app/utils/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as yup from "yup";
import { AxiosError } from "axios";
import { FormGroupProps, ToolbarChip } from "@patternfly/react-core";
import { StringSchema } from "yup";

// Axios error

Expand Down Expand Up @@ -104,11 +104,15 @@ export const gitUrlRegex =
export const standardStrictURLRegex =
/https:\/\/(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,4}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/;

export const customURLValidation = (schema: StringSchema) => {
export const svnUrlRegex = /^svn:\/\/[^\s/$.?#].[^\s]*$/;

export const customURLValidation = (schema: yup.StringSchema) => {
const containsURL = (string: string) =>
gitUrlRegex.test(string) || standardURLRegex.test(string);
gitUrlRegex.test(string) ||
standardURLRegex.test(string) ||
svnUrlRegex.test(string);

return schema.test("gitUrlTest", "Must be a valid URL.", (value) => {
return schema.test("urlValidation", "Must be a valid URL.", (value) => {
if (value) {
return containsURL(value);
} else {
Expand Down

0 comments on commit 529f99b

Please sign in to comment.