chore: collection and folder as request names are reserved

This commit is contained in:
Anoop M D 2023-10-09 07:08:36 +05:30
parent 2d149d94ef
commit 53eb53e062
2 changed files with 4 additions and 4 deletions

2
package-lock.json generated
View File

@ -20025,7 +20025,7 @@
"lodash": "^4.17.21",
"mustache": "^4.2.0",
"qs": "^6.11.0",
"socks-proxy-agent": "*",
"socks-proxy-agent": "^8.0.2",
"yargs": "^17.6.2"
},
"dependencies": {

View File

@ -29,10 +29,10 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
.required('name is required')
.test({
name: 'requestName',
message: 'The request name "index" is reserved in bruno',
message: `The request names - collection and folder is reserved in bruno`,
test: (value) => {
const regex = /(\s|^)\W*index\W*(\s|$)/i;
return value && !regex.test(value);
const trimmedValue = value.trim().toLowerCase();
return !['collection', 'folder'].includes(trimmedValue);
}
})
}),