statamic / eloquent-driver

Provides support for storing your Statamic data in a database, rather than flat files.
https://statamic.dev/tips/storing-content-in-a-database
MIT License
108 stars 78 forks source link

Asset Folder Nesting Bug #355

Closed danielml01 closed 1 month ago

danielml01 commented 1 month ago

Bug description

If I have a folder named "Pineapple" in an assets container and create a sibling folder named "Pineapple-Pizza" in the same container, Pineapple-Pizza will display in the Pineapple folder (control panel assets view.)

Likewise, if I have a folder name Draft and try to rename it to Draft_v1 I will get an error that a folder cannot be moved into its own subdirectory.

How to reproduce

Go to the control panel Assets view and create a folder named "Thing" Add an asset to it (so it doesn't disappear on page refresh) At the same top level, add a folder named "Thing-2" & add an asset to it Now click into the "Thing" folder. You will see the "Thing-2" folder nested inside. Now trying to rename the "Thing" folder to "Thing-1" You will get a server error.

Logs

No response

Environment

Environment
Application Name: REDACTED
Laravel Version: 10.48.22
PHP Version: 8.1.20
Composer Version: 2.5.8
Environment: dev
Debug Mode: OFF
URL: REDACTED
Maintenance Mode: OFF

Cache
Config: CACHED
Events: NOT CACHED
Routes: CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: redis
Database: mysql
Logs: errorlog
Mail: smtp
Queue: sync
Session: file

Statamic
Addons: 15
Sites: 1
Stache Watcher: Disabled
Static Caching: Disabled
Version: 5.26.0 PRO

Statamic Addons
alt-design/alt-redirect: 1.3.2
aryehraber/statamic-logbook: 3.3.0
doefom/statamic-export: 0.4.0
jacksleight/statamic-bard-texstyle: 3.3.0
kadegray/statamic-country-and-region-fieldtypes: 1.2.4
rias/statamic-color-swatches: 2.3.0
simonridley/tracking-code-manager: 1.0.2
statamic/collaboration: 1.0.0
statamic/eloquent-driver: 4.14.3
stillat/relationships: 2.2.1
teamddm/aws-transcode: dev-statamic/bugfix/prod-php-errors
teamddm/cp-password-expires: dev-statamic/bugfix/prod-php-errors
teamddm/statamic-mixpanel: dev-statamic/bugfix/prod-php-errors
teamddm/statamic-pdf-thumbnailer: dev-statamic/bugfix/prod-php-errors
webographen/statamic-admin-log: 1.1.0

Statamic Eloquent Driver
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: file
Collections: file
Entries: file
Forms: file
Global Sets: file
Global Variables: file
Navigation Trees: file
Navigations: file
Revisions: file
Sites: file
Taxonomies: file
Terms: file
Tokens: file

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

jasonvarga commented 1 month ago

This only happens when using assets in the eloquent driver. I'll move the issue.

ryanmitchell commented 1 month ago

I've opened a PR with some changes that should resolve this - https://github.com/statamic/eloquent-driver/pull/356 - can you check it on your install?