Skip to content

Commit

Permalink
[frontend] External reference URL are not properly validated during c…
Browse files Browse the repository at this point in the history
…reation (#7431)
  • Loading branch information
SarahBocognano committed Jul 4, 2024
1 parent c317384 commit 579d47c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,12 @@ export const externalReferenceCreationMutation = graphql`
const externalReferenceValidation = (t: (value: string) => string) => Yup.object().shape({
source_name: Yup.string().required(t('This field is required')),
external_id: Yup.string().nullable(),
url: Yup.string().url(t('The value must be an URL')).nullable(),
url: Yup.string()
.nullable()
.matches(
/^(https?:\/\/[^\s/$.?#].[^\s]*)$/,
t('The value must be a valid URL'),
),
description: Yup.string().nullable(),
file: Yup.mixed().nullable(),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,12 @@ export const externalReferenceEditionOverviewFocus = graphql`
const externalReferenceValidation = (t: (value: string) => string) => Yup.object().shape({
source_name: Yup.string().required(t('This field is required')),
external_id: Yup.string().nullable(),
url: Yup.string().url(t('The value must be an URL')).nullable(),
url: Yup.string()
.nullable()
.matches(
/^(https?:\/\/[^\s/$.?#].[^\s]*)$/,
t('The value must be a valid URL'),
),
description: Yup.string().nullable(),
});

Expand Down

0 comments on commit 579d47c

Please sign in to comment.