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

Panel: "Invalid regular expression: nothing to repeat" with Custom Slug Rules Containing `+` (3.2.5 Regression) #2138

Closed
neildaniels opened this issue Sep 25, 2019 · 3 comments

Comments

@neildaniels
Copy link
Contributor

@neildaniels neildaniels commented Sep 25, 2019

Describe the bug
When creating a new page in the Panel, as you type in the Title field, an error is displayed that says "Invalid regular expression: nothing to repeat"

It appears the regression has to do with a custom slug override that includes a +. This was previously fixed with #1946, but seems to have been reverted?

In my config.php, for example:

Str::$language = [
    '+' => '-plus',
];

To Reproduce
Steps to reproduce the behavior:

  1. Have custom slugs defined like above
  2. Click on a "Create" button in a Pages section
  3. Type a character of a title

Screenshots
Screen Shot 2019-09-25 at 11 54 49 AM

Kirby Version
3.2.5

Console output
None

Desktop (please complete the following information):

  • OS: macOS
  • Browser: Safari
  • Version: Version 13.0.1

Additional context
No issues on 3.2.4

@neildaniels neildaniels changed the title Panel: "Invalid regular expression: nothing to repeat" When Typing Title for New Page (3.2.5 Regression) Panel: "Invalid regular expression: nothing to repeat" with Custom Slug Rules Containing `+` (3.2.5 Regression) Sep 25, 2019
@afbora

This comment has been minimized.

Copy link
Contributor

@afbora afbora commented Sep 25, 2019

I can reproduce too. This issue about this PR: #2112

We added \p unicode property to work stable for unicode languages and works great!
But we missed + sign as @distantnative worried on RC tests

So when we enable unicode support, + does not work 🤔
Maybe to give you an idea to make better solution, it works with escape like following

Str::$language = [
    '\+' => '-plus',
];
@bastianallgeier

This comment has been minimized.

Copy link
Contributor

@bastianallgeier bastianallgeier commented Sep 26, 2019

I'm really sorry! I added all sorts of unit tests after the change, but I forgot to test the plus sign replacement: https://github.com/getkirby/kirby/blob/master/panel/tests/unit/Helpers/Slug.spec.js

@bastianallgeier

This comment has been minimized.

Copy link
Contributor

@bastianallgeier bastianallgeier commented Sep 27, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants
You can’t perform that action at this time.