forked from extern/bruno
feat: error messages for reserved file and folder names in bruno
This commit is contained in:
parent
5f59a16090
commit
78ca6c5e96
@ -15,7 +15,19 @@ const NewFolder = ({ collection, item, onClose }) => {
|
|||||||
folderName: ''
|
folderName: ''
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
folderName: Yup.string().min(1, 'must be atleast 1 characters').max(50, 'must be 50 characters or less').required('name is required')
|
folderName: Yup.string()
|
||||||
|
.min(1, 'must be atleast 1 characters')
|
||||||
|
.required('name is required')
|
||||||
|
.test({
|
||||||
|
name: 'folderName',
|
||||||
|
message: 'The folder name "environments" at the root of the collection is reserved in bruno',
|
||||||
|
test:(value) => {
|
||||||
|
if(item && item.uid) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return !(value.trim().toLowerCase().includes('environments'))
|
||||||
|
}
|
||||||
|
})
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
dispatch(newFolder(values.folderName, collection.uid, item ? item.uid : null))
|
dispatch(newFolder(values.folderName, collection.uid, item ? item.uid : null))
|
||||||
|
@ -24,7 +24,14 @@ const NewRequest = ({ collection, item, isEphermal, onClose }) => {
|
|||||||
requestMethod: 'GET'
|
requestMethod: 'GET'
|
||||||
},
|
},
|
||||||
validationSchema: Yup.object({
|
validationSchema: Yup.object({
|
||||||
requestName: Yup.string().min(1, 'must be atleast 1 characters').max(50, 'must be 50 characters or less').required('name is required')
|
requestName: Yup.string()
|
||||||
|
.min(1, 'must be atleast 1 characters')
|
||||||
|
.required('name is required')
|
||||||
|
.test({
|
||||||
|
name: 'requestName',
|
||||||
|
message: 'The request name "index" is reserved in bruno',
|
||||||
|
test: value => !(value.trim().toLowerCase().includes('index')),
|
||||||
|
})
|
||||||
}),
|
}),
|
||||||
onSubmit: (values) => {
|
onSubmit: (values) => {
|
||||||
if (isEphermal) {
|
if (isEphermal) {
|
||||||
|
Loading…
Reference in New Issue
Block a user