Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -526,8 +526,8 @@ export default function EnvironmentPath({
const NewFolderMenu = () => {
const [name, setName] = useState<string>('')

// Regular expression to match only alphanumeric characters
const regex = /^[a-zA-Z0-9]*$/
// Regular expression to match only alphanumeric characters along with dashes (-) and underscores (_)
const folder_name_pattern = /^[a-zA-Z0-9_-]*$/

const closeModal = () => {
setFolderMenuIsOpen(false)
Expand All @@ -543,11 +543,9 @@ export default function EnvironmentPath({
}

const handleUpdateName = (newName: string) => {
// Regular expression to match only alphanumeric characters
const regex = /^[a-zA-Z0-9]*$/

// Check if the new value matches the regular expression
if (regex.test(newName) || newName === '') {
if (folder_name_pattern.test(newName) || newName === '') {
// Update the state if the value is alphanumeric or empty (to allow clearing the input)
setName(newName)
}
Expand Down