mirror of
https://github.com/oceanprotocol/market.git
synced 2024-12-02 05:57:29 +01:00
Checking for google drive links (#1757)
* checking for google drive links * Removing unused function * Update src/components/Publish/_validation.ts Co-authored-by: Matthias Kretschmann <m@kretschmann.io> * CHecking for google drive URLs on the edit form Co-authored-by: Matthias Kretschmann <m@kretschmann.io>
This commit is contained in:
parent
6d0ce2d708
commit
d1e3fa9afa
@ -10,7 +10,15 @@ export const validationSchema = Yup.object().shape({
|
|||||||
files: Yup.array<FileInfo[]>()
|
files: Yup.array<FileInfo[]>()
|
||||||
.of(
|
.of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
url: Yup.string().url('Must be a valid URL.'),
|
url: Yup.string()
|
||||||
|
.url('Must be a valid URL.')
|
||||||
|
.test(
|
||||||
|
'GoogleNotSupported',
|
||||||
|
'Google Drive is not a supported hosting service. Please use an alternative.',
|
||||||
|
(value) => {
|
||||||
|
return !value?.toString().includes('drive.google')
|
||||||
|
}
|
||||||
|
),
|
||||||
valid: Yup.boolean().isTrue()
|
valid: Yup.boolean().isTrue()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@ -18,7 +26,15 @@ export const validationSchema = Yup.object().shape({
|
|||||||
links: Yup.array<FileInfo[]>()
|
links: Yup.array<FileInfo[]>()
|
||||||
.of(
|
.of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
url: Yup.string().url('Must be a valid URL.'),
|
url: Yup.string()
|
||||||
|
.url('Must be a valid URL.')
|
||||||
|
.test(
|
||||||
|
'GoogleNotSupported',
|
||||||
|
'Google Drive is not a supported hosting service. Please use an alternative.',
|
||||||
|
(value) => {
|
||||||
|
return !value?.toString().includes('drive.google')
|
||||||
|
}
|
||||||
|
),
|
||||||
valid: Yup.boolean().isTrue()
|
valid: Yup.boolean().isTrue()
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
@ -32,7 +32,17 @@ const validationService = {
|
|||||||
files: Yup.array<FileInfo[]>()
|
files: Yup.array<FileInfo[]>()
|
||||||
.of(
|
.of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
url: Yup.string().url('Must be a valid URL.').required('Required'),
|
url: Yup.string()
|
||||||
|
.test(
|
||||||
|
'GoogleNotSupported',
|
||||||
|
'Google Drive is not a supported hosting service. Please use an alternative.',
|
||||||
|
(value) => {
|
||||||
|
return !value?.toString().includes('drive.google')
|
||||||
|
}
|
||||||
|
)
|
||||||
|
.url('Must be a valid URL.')
|
||||||
|
.required('Required'),
|
||||||
|
|
||||||
valid: Yup.boolean().isTrue().required('File must be valid.')
|
valid: Yup.boolean().isTrue().required('File must be valid.')
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
@ -41,7 +51,15 @@ const validationService = {
|
|||||||
links: Yup.array<FileInfo[]>()
|
links: Yup.array<FileInfo[]>()
|
||||||
.of(
|
.of(
|
||||||
Yup.object().shape({
|
Yup.object().shape({
|
||||||
url: Yup.string().url('Must be a valid URL.'),
|
url: Yup.string()
|
||||||
|
.url('Must be a valid URL.')
|
||||||
|
.test(
|
||||||
|
'GoogleNotSupported',
|
||||||
|
'Google Drive is not a supported hosting service. Please use an alternative.',
|
||||||
|
(value) => {
|
||||||
|
return !value?.toString().includes('drive.google')
|
||||||
|
}
|
||||||
|
),
|
||||||
// TODO: require valid file only when URL is given
|
// TODO: require valid file only when URL is given
|
||||||
valid: Yup.boolean()
|
valid: Yup.boolean()
|
||||||
// valid: Yup.boolean().isTrue('File must be valid.')
|
// valid: Yup.boolean().isTrue('File must be valid.')
|
||||||
|
Loading…
Reference in New Issue
Block a user