Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 allow svn source repos to be validated #1346

Merged
merged 2 commits into from
Sep 11, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 { ToolbarChip } from "@patternfly/react-core";
import { StringSchema } from "yup";
import { Paths } from "@app/Paths";

// Axios error
Expand Down Expand Up @@ -112,11 +112,15 @@
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);

Check warning on line 121 in client/src/app/utils/utils.ts

View check run for this annotation

Codecov / codecov/patch

client/src/app/utils/utils.ts#L120-L121

Added lines #L120 - L121 were not covered by tests

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
Loading