-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
The index name field is type string however we also want to restrict it to: alphanumeric, dash, underscore and dot.
Barring using a validator library like Zod (should we?), it could be a simple function like so:
export function isValidName(str:string) {
const regex = /^[a-zA-Z\-_.]+$/
return regex.test(str)
}
Also look into: Unknown what Strapi validation features we could leverage, especially because we use our own custom types.
This validation should be applied to:
Admin pages:
- The HTML input field when creating an index
- Submission of the create index API
Server:
- Any function dealing with index name
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels