statamic / v2-hub

Statamic 2 - Feature Requests and Bug Reports
https://statamic.com
95 stars 5 forks source link

Problem when reordering pages with duplicate slugs #1938

Open d35k opened 6 years ago

d35k commented 6 years ago

Describe the bug Im gettin error while reordering any page in Pages area.

To Reproduce Steps to reproduce the behavior:

  1. Go to Pages
  2. Reorder any of them.
  3. See error

Expected behavior I reordered my Contact page. I only did in once time, after that, i cant reordered my pages.

Environment details (please complete the following information):

Error Log

[2018-05-22 16:04:54] production.ERROR: League\Flysystem\FileExistsException: File already exists at path: pages/3.videos/index.md in /Users/g-mac/Projects/blog/statamic/vendor/league/flysystem/src/Filesystem.php:402
Stack trace:
 /Users/g-mac/Projects/blog/statamic/vendor/league/flysystem/src/Filesystem.php(211): League\Flysystem\Filesystem->assertAbsent('pages/3.videos...')
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Filesystem/FilesystemAdapter.php(182): League\Flysystem\Filesystem->rename('pages/2.videos...', 'pages/3.videos...')
 /Users/g-mac/Projects/blog/statamic/core/Filesystem/FileAccessor.php(136): Illuminate\Filesystem\FilesystemAdapter->move('pages/2.videos...', 'pages/3.videos...')
 /Users/g-mac/Projects/blog/statamic/core/Filesystem/FolderAccessor.php(241): Statamic\Filesystem\FileAccessor->rename('pages/2.videos...', 'pages/3.videos...')
 /Users/g-mac/Projects/blog/statamic/core/Data/Pages/PageTreeReorderer.php(29): Statamic\Filesystem\FolderAccessor->rename('pages/2.videos', 'pages/3.videos')
 /Users/g-mac/Projects/blog/statamic/core/Http/Controllers/PagesController.php(164): Statamic\Data\Pages\PageTreeReorderer->reorder(Array)
 [internal function]: Statamic\Http\Controllers\PagesController->save(Object(Statamic\Data\Pages\PageTreeReorderer))
/Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(256): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(164): Illuminate\Routing\Controller->callAction('save', Array)
/Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(112): Illuminate\Routing\ControllerDispatcher->call(Object(Statamic\Http\Controllers\PagesController), Object(Illuminate\Routing\Route), 'save')
 [internal function]: Illuminate\Routing\ControllerDispatcher->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(114): Illuminate\Pipeline\Pipeline->then(Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(68): Illuminate\Routing\ControllerDispatcher->callWithinStack(Object(Statamic\Http\Controllers\PagesController), Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'save')
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/Route.php(203): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'Statamic\\Http\\C...', 'save')
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/Route.php(134): Illuminate\Routing\Route->runWithCustomDispatcher(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/Router.php(708): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/core/Http/Middleware/CP/Authenticate.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Statamic\Http\Middleware\CP\Authenticate->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/core/Http/Middleware/Outpost.php(48): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Statamic\Http\Middleware\Outpost->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/core/Http/Middleware/CP/Localize.php(25): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Statamic\Http\Middleware\CP\Localize->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/core/Http/Middleware/CP/DefaultLocale.php(28): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Statamic\Http\Middleware\CP\DefaultLocale->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/core/Http/Middleware/CpEnabled.php(23): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Statamic\Http\Middleware\CpEnabled->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/Router.php(710): Illuminate\Pipeline\Pipeline->then(Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/Router.php(674): Illuminate\Routing\Router->runRouteWithinStack(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Routing/Router.php(635): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(236): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Foundation\Http\Kernel->Illuminate\Foundation\Http\{closure}(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(139): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/core/Http/Middleware/PersistStache.php(22): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Statamic\Http\Middleware\PersistStache->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php(50): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Foundation\Http\Middleware\VerifyCsrfToken->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/View/Middleware/ShareErrorsFromSession.php(49): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\View\Middleware\ShareErrorsFromSession->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Session/Middleware/StartSession.php(62): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Session\Middleware\StartSession->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/AddQueuedCookiesToResponse.php(37): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
/Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Cookie/Middleware/EncryptCookies.php(59): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Cookie\Middleware\EncryptCookies->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/core/StaticCaching/Middleware/Retrieve.php(33): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Statamic\StaticCaching\Middleware\Retrieve->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(44): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 [internal function]: Illuminate\Foundation\Http\Middleware\CheckForMaintenanceMode->handle(Object(Illuminate\Http\Request), Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(124): call_user_func_array(Array, Array)
 [internal function]: Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(102): call_user_func(Object(Closure), Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(122): Illuminate\Pipeline\Pipeline->then(Object(Closure))
 /Users/g-mac/Projects/blog/statamic/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(87): Illuminate\Foundation\Http\Kernel->sendRequestThroughRouter(Object(Illuminate\Http\Request))
 /Users/g-mac/Projects/blog/index.php(155): Illuminate\Foundation\Http\Kernel->handle(Object(Illuminate\Http\Request))
 /Users/g-mac/.composer/vendor/laravel/valet/server.php(147): require('/Users/g-mac/Pr...')
 {main}
jackmcdade commented 6 years ago

Do you have any unpublished pages?

d35k commented 6 years ago

No

jasonvarga commented 6 years ago

(Please surround stack traces in code blocks. Otherwise every line causes a github issue of that number to get referenced.)

d35k commented 6 years ago

updated

jackmcdade commented 6 years ago

I can't recreate this - can you share any other info? A screenshot of the browser and error? Or your file structure?

d35k commented 6 years ago

screenrecord.zip there it is

jwbrew commented 6 years ago

We're having the same problem; same exception & trace.

Site & content fully version controlled - happy to share privately with Statamic team if needed

barnabas-szekeres commented 5 years ago

Is it possible to reopen this issue? We're also run into this problem :(

League\Flysystem\FileExistsException: File already exists at path: pages/1.mac/8.mac-kiegeszitok/9.nagy-sebessegu-adatkabelek-es-adapterek/12.owc-sabrent-usb-3-0-eloszto/index.md

php please clear:stache command can "solve" the problem. Any idea what can cause this issue?

PS.: I can share the whole file system if it necessary!

barnabas-szekeres commented 5 years ago

Woooho, we found the reproduction process!

The issue comes from creating a page with an existing slug.

Of course the CP prevents you from making a page with an existing slug, both on the same tree level, but if you do this on another level, you can create it (eg. /foo and /bar/foo). After creating both pages, if you move one next to the other (eg. /foo into the /bar folder), there are going to be two folders with the same slugs (/bar/1.foo, /bar/2.foo).

This messes up Stache and no page reordering from then on is going to work.

@jackmcdade should I open a new issue or can we reopen this?

mirill1 commented 5 years ago

Any news on this bug?? @jackmcdade

anthubbard commented 5 years ago

I have this issue as well, it's affecting a few live sites and I keep having to go in and fix them, could you please look into it?

Thanks.

Ant.

Thaars commented 4 years ago

I have the same problem. We have two languages. Some pages do not exist in the main language. Therefore pages were created in the main and in the 2nd language, but the main language was deactivated. The following files are in the site/content/pages/ folder:

_1.clients
_2.practical-examples
2.practical-examples
_3.advertising-media
en.index.md
index.md

Both folders contain one index file per language. Is this correct or could this cause a problem?

[2020-02-13 09:13:59] stage.ERROR: League\Flysystem\FileExistsException: File already exists at path: pages/2.personnel_consultation/_6.working-method/_2.practical-examples/en.index.md in /.../releases/26/statamic/vendor/league/flysystem/src/Filesystem.php:405

rdarcy1 commented 4 years ago

@jackmcdade @jasonvarga any progress on this? We have a (non-technical) client who keeps running into this issue.

Even displaying an error on the UI and cancelling the move would be fine. Currently it seems to allow the page move but then fails on all subsequent moves.