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

Slug with umlauts break the page #2398

Closed
rrelmy opened this issue May 13, 2019 · 1 comment

Comments

Projects
None yet
3 participants
@rrelmy
Copy link

commented May 13, 2019

Describe the bug
Using umlauts like äöüèéà… in entry slugs (most likely pages too) breaks the entire page.
Our customers like to use umlauts in slugs and continuously break the page with it.

InvalidEntryTypeException in Entry.php line 201:
Entry date not present in a date-based entry: [collections/summer-news/sommersaisonstüüürt.md]

The nasty thing it is working until you clear the cache and the data is reloaded from disk.

Related: #824

Proposed solution 😏
The regexes in OrderParser->get(Entry|Page)Order are causing the issue.
They try to catch the rest of the filename with \w, \w does not include characters like umlauts.

My proposal would be to replace the [\w_-]+ pattern with [^\/]+ to match every possible character.
I tested this change with a site and could not find any problems so far.

To Reproduce
Steps to reproduce the behavior:

  1. CP: Add a umlaut äöü directly to the slug of an entry
  2. Save, everything works until cache is cleared
  3. Clear cache
  4. See error

Expected behavior
The cp should disallow using such characters or it should work.

Environment details (please complete the following information):

  • Statamic Version: 2.11.9
  • Fresh Install or Upgrade: Fresh
  • OS: macOS, Ubuntu 16.04
  • Browser: Chrome
  • Web Server: valet, nginx
  • PHP Version: 7.3
  • Addons installed: some

@jesseleite jesseleite self-assigned this Jun 27, 2019

@jesseleite

This comment has been minimized.

Copy link
Member

commented Jun 27, 2019

Opted for a slightly different approach, by conventionally wrapping slugs with Laravel's Str::slug($slug) to ensure that umlauts and similar characters don't make it through filenames, URLs, etc. Should be in next release though!

@jackmcdade jackmcdade closed this Jun 28, 2019

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