mirror of
https://github.com/sct/overseerr.git
synced 2025-09-17 17:24:35 +02:00
fix(ui): Add additional URL & email input validation (#843)
This commit is contained in:
@@ -52,6 +52,8 @@ const messages = defineMessages({
|
||||
preventSearch: 'Disable Auto-Search',
|
||||
validationApplicationUrl: 'You must provide a valid URL',
|
||||
validationApplicationUrlTrailingSlash: 'URL must not end in a trailing slash',
|
||||
validationBaseUrlLeadingSlash: 'Base URL must have a leading slash',
|
||||
validationBaseUrlTrailingSlash: 'Base URL must not end in a trailing slash',
|
||||
});
|
||||
|
||||
interface TestResponse {
|
||||
@@ -119,6 +121,27 @@ const RadarrModal: React.FC<RadarrModalProps> = ({
|
||||
return true;
|
||||
}
|
||||
),
|
||||
baseUrl: Yup.string()
|
||||
.test(
|
||||
'leading-slash',
|
||||
intl.formatMessage(messages.validationBaseUrlLeadingSlash),
|
||||
(value) => {
|
||||
if (value && value?.substr(0, 1) !== '/') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
)
|
||||
.test(
|
||||
'no-trailing-slash',
|
||||
intl.formatMessage(messages.validationBaseUrlTrailingSlash),
|
||||
(value) => {
|
||||
if (value?.substr(value.length - 1) === '/') {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
),
|
||||
});
|
||||
|
||||
const testConnection = useCallback(
|
||||
|
Reference in New Issue
Block a user