Skip to content

[4.x]: Assets are moved when using {site.handle} in Asset Location #12767

@tommysvr

Description

@tommysvr

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

  1. On a multisite install with Site A and Site B
  2. Add an Assets field with 'Restrict assets to a single location' checked and the Asset Location {site.handle}
  3. On a new Entry in Site A, upload an image -> save Entry
  4. Asset will be saved to the siteB folder
  5. Switch to Site B, upload another asset
  6. All assets will be moved to siteA folder

Expected 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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions