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

Cannot create child page if parent page's uri contains "/" #1225

Closed
thomasgerard opened this Issue Feb 1, 2017 · 1 comment

Comments

Projects
None yet
2 participants
@thomasgerard

thomasgerard commented Feb 1, 2017

Expected behaviour

In the pages list, when you want to create a page as a child of an existing page that is already a child (depth: 2), you should see the Create new page form.

Actual behaviour

404 error

Steps to reproduce

  1. Statamic >2.5
  2. Go Pages list
  3. Try to create a page from any page that has a depth > 1 (parentpage/childpage)

Origin of the error

The routing system doesn't find what cp route is appropriate if the parent page's uri contains a slash. Indeed, PublishPageController->create() is not called.

Solution

In /statamic/core/Http/routes-cp.php, line 37
get('create/{parent?}', 'PublishPageController@create')->name('page.create');
was before v2.5
get('create/{url?}', 'PublishController@createPage')->where('url', '.*')->name('page.create');

So I changed it to
get('create/{parent?}', 'PublishPageController@create')->name('page.create')->where('parent', '.*');

That fixed it, needs further testing to confirm it doesn't break anything.

@jackmcdade jackmcdade added the bug label Feb 1, 2017

@jackmcdade

This comment has been minimized.

Member

jackmcdade commented Feb 1, 2017

Nice catch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment