mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-21 23:43:15 +01:00
♻️ Update request name validation regex
This commit is contained in:
parent
89770cce28
commit
1e487b8250
@ -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;
|
||||
}
|
||||
|
@ -1 +1,2 @@
|
||||
export const variableNameRegex = /^[\w-.]*$/;
|
||||
export const fileNameRegex = /^[^<>:"/\\|?*]+$/;
|
Loading…
Reference in New Issue
Block a user