-
Notifications
You must be signed in to change notification settings - Fork 667
[4.x]: Assets are moved when using {site.handle}
in Asset Location
#12767
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
Comments
@i-just We probably should not be moving assets if |
@brandonkelly We've been experiencing this on a project we upgraded to craft 4, the majority of our asset fields have {site.handle} as an asset location. The behaviour we are seeing is that for site shared elements often the asset gets 'moved' to the last site in the sites query, which typically is the last site when grouped by the site group (in alphabetical order) same as it is displayed in the sites area of the control panel. The original motivation behind using {site.handle} in the asset location was to try to prevent people using different sites from seeing the assets from the other sites. When I say shared elements i mean those that retain the same element ID across multiple sites, e.g. categories, singles, or any entry that is propagated to all sites. Am i right in assuming that in this scenario (where the same element ID is retained across multiple sites), that the use of {site.handle} in the upload / folder location of the field settings is incompatible because the asset volume folders are not multi site, and the asset itself can only have one folderId? |
@jlawrence-yellostudio Correct |
Craft 4.14.12 and 5.6.14 are out with a fix for this: assets are no longer relocated for propagated sites. (#16938) |
What happened?
Description
Assets are being saved to the wrong folder when uploading to a field with 'Restrict assets to a single location' and
{site.handle}
inside the Asset Location. Able to reproduce on 3.7.67 and 4.3.10.Steps to reproduce
{site.handle}
siteB
foldersiteA
folderExpected behavior
Assets will be saved to the folder corresponding to the site being edited.
Actual behavior
All Assets are moved after saving an Entry.
Here are Composer files and a database dump from a fresh install with the above setup to hopefully help quickly reproduce: composer-db.zip
Craft CMS version
4.3.10 and 3.7.67
PHP version
8.0
Operating system and version
No response
Database type and version
MariaDB 10.4
Image driver and version
No response
Installed plugins and versions
The text was updated successfully, but these errors were encountered: