♻️ Update request name validation regex

This commit is contained in:
Camilo Pulido 2024-08-09 00:20:32 +02:00
parent 89770cce28
commit 1e487b8250
2 changed files with 4 additions and 3 deletions

View File

@ -12,7 +12,7 @@ import HttpMethodSelector from 'components/RequestPane/QueryUrl/HttpMethodSelect
import { getDefaultRequestPaneTab } from 'utils/collections';
import StyledWrapper from './StyledWrapper';
import { getRequestFromCurlCommand } from 'utils/curl';
import { variableNameRegex } from 'utils/common/regex';
import { fileNameRegex } from 'utils/common/regex';
const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
const dispatch = useDispatch();
@ -59,9 +59,9 @@ const NewRequest = ({ collection, item, isEphemeral, onClose }) => {
name: 'requestName',
message: `The request names - collection and folder is reserved in bruno`,
test: (value) => {
if (variableNameRegex.test(value) === false) {
if (fileNameRegex.test(value) === false) {
toast.error(
`Request name contains invalid characters! Request names must only contain alpha-numeric characters, "-", "_", "."`
`Request name contains invalid characters! Request names must not contain any of the following characters: < > : " / \ | ? *`
);
return false;
}

View File

@ -1 +1,2 @@
export const variableNameRegex = /^[\w-.]*$/;
export const fileNameRegex = /^[^<>:"/\\|?*]+$/;