Skip to content
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

[3.x]: Assets added with dynamic paths remain in temporary uploads #11462

Closed
anita-chouhan opened this issue Jun 20, 2022 · 6 comments
Closed

Comments

@anita-chouhan
Copy link

anita-chouhan commented Jun 20, 2022

What happened?

Description

We’re facing an issue with the dynamic Asset location paths. We have an Asset field in a Vizy block that is inside a Matrix block. If we try to upload an Asset file while adding/editing an entry after adding the Matrix field to an entry type, it remains in the Temporary Uploads folder instead of transferring to the correct location. I tried the Default Asset Location dynamic path values as {owner.slug} , {owner.owner.slug}  and {now|date('Y')} . None of these worked.

I performed some tests and found that the issue does not exist when using Craft CMS version 3.7.13. I think that changes made in later versions of Craft CMS had an impact on the dynamic path construction for Assets.

I have reported the [issue](verbb/vizy#80) with the Vizy plugin as well.

Craft CMS version

3.7.44

PHP version

7.4.27

Operating system and version

Darwin 20.6.0

Database type and version

MySQL 5.7.37

Image driver and version

GD 7.4.27

Installed plugins and versions

  • Vizy Plugin: 1.0.15
@brandonkelly
Copy link
Member

This is now fixed for the next release.

Caused by these changes in Craft 3.7.17, related to #9619.

The real issue here is that Vizy blocks don’t have IDs, so they aren’t real elements despite extending craft\base\Element and supporting custom fields. Assets fields were (reasonably) assuming that a saved element would have an ID.

@brandonkelly
Copy link
Member

Craft 3.7.45 and 4.0.5 are out now with that fix.

@anita-chouhan
Copy link
Author

After upgrading to Craft 3.7.45, it worked. Thank you for providing the fix.

@brandonkelly
Copy link
Member

Glad to hear!

@anita-chouhan
Copy link
Author

anita-chouhan commented Jun 23, 2022

Update

I performed some tests and found that when we upload an asset for the first time into the Asset field (inside Vizy block in Matrix field) and the Default Asset Location has a dynamic path value, an error message stating "Asset can’t be blank." appears.

After another try, everything is fine. See the image below:
error

@brandonkelly
Copy link
Member

@anita-chouhan If it’s a required field, then that would mean something Vizy is doing is triggering validation. Fields won’t ever validate themselves. So this is going to be a Vizy bug.

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

No branches or pull requests

2 participants