Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Field pattern not working correctly on creating/editing posts #6500

Open
DanielKraemer opened this issue Jun 27, 2022 · 0 comments
Open

Field pattern not working correctly on creating/editing posts #6500

DanielKraemer opened this issue Jun 27, 2022 · 0 comments
Labels
type: bug code to address defects in shipped code

Comments

@DanielKraemer
Copy link

Describe the bug
We have some fields with pattern usage like /^.{0,130}$/gmi
If I create a new post, this works fine.
But when I edit a post, I receive an error message, that the fields content doesn't match my regex pattern.
Sometimes it works and sometimes it won't, seems to be very flaky ....

Works correctly
image

Should also work correctly
image

To Reproduce

  1. Create a field configuration with a field like
    { label: 'Teaser', name: 'teaser', widget: 'text', pattern: [/^.{0,130}$/gmi, 'Max amount of 130 characters'], }

  2. Create a new post with this field filled correctly (tested this using regexr.com)

  3. Save the new post, all should works fine

  4. Edit the post and add or remove a line

  5. Try to save it, you'll receive an error

Expected behavior
Pattern work correctly on editing

Screenshots
See above

Applicable Versions:

  • "netlify-cms-app": "^2.15.72",
@DanielKraemer DanielKraemer added the type: bug code to address defects in shipped code label Jun 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

No branches or pull requests

1 participant