appwrite: πŸ› Bug Report: Some Pattern Input Validation Aren't Working

πŸ‘Ÿ Reproduction steps

  1. Open a modal to create a Database
  2. Type Default for Name
  3. Type in inv@lid for Database ID
  4. Click Create

πŸ‘ Expected behavior

Client-side validation should run and the user should see a warning in the modal.

πŸ‘Ž Actual Behavior

The API request is made and there is a server-side error.

Looking at the console logs, it looks like the pattern is invalid:

image

Pattern attribute value ^[a-zA-Z0-9][a-zA-Z0-9.-]*$ is not a valid regular expression: Uncaught SyntaxError: Invalid regular expression: /^[a-zA-Z0-9][a-zA-Z0-9.-]*$/v: Invalid character in character class

You can reproduce this by running:

pattern = String.raw`^[a-zA-Z0-9][a-zA-Z0-9._-]*$`;
r = new RegExp(pattern, 'v');

I think the problem is the pattern’s last dash (-).

Tasks

🎲 Appwrite version

Version 1.3.x

πŸ’» Operating system

Linux

🧱 Your Environment

No response

πŸ‘€ Have you spent some time to check if this issue has been raised before?

  • I checked and didn’t find similar issue

🏒 Have you read the Code of Conduct?

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 38 (12 by maintainers)

Most upvoted comments

@0xchikku currently working bro

@webAbhi, assigned! Thanks for your interest! Please keep us updated on your progress so that we don’t re-assign this to someone else πŸ™πŸΌ

@Haimantika i stuck somewhere i will resolve this in a week

Cool, do not hesitate to reach out to us on Discord

@Ayushpanditmoto, did you want to work on this?

@webAbhi, we assign on a first come first serve basis so I’ll assign it to you if @Ayushpanditmoto doesn’t want to work on it.