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

[5.x]: Dynamic folder paths not creating new folder #15775

Closed
paul-frost opened this issue Sep 22, 2024 · 2 comments
Closed

[5.x]: Dynamic folder paths not creating new folder #15775

paul-frost opened this issue Sep 22, 2024 · 2 comments
Assignees
Labels

Comments

@paul-frost
Copy link

What happened?

Description

I have an assets field where I want to create a new folder based on 2 data fields of the entry. But if there is no folder with that name the modal window that pops up when you select you want to upload is blank with no upload options. If I create the folder in advance in Assets it works as expected. This is within a Matrix field but I've tried it with in a standalone assets field too.
The code I have been using in Craft 4 is:
{% if owner.startDate %}{owner.startDate|date('Y')}/{owner.startDate|date('Y-m-d')}_{owner.eventTitle|kebab}{%else%}default{%endif%}
I've also tested by just adding a simple 2024 instead of the twig variables, and if there is no existing 2024 folder it fails, see image below.
blank modal

I think this was working before. I'm building a new site (using DDEV locally) and this part was built a month or more ago and I'm pretty sure it was working then. I've just uploaded the site to a staging server and that's when I spotted it not working, and it's not working on my local DDEV either.

Steps to reproduce

  1. Create an Assets field, select 'Restrict assets to a single location' enter a location in the path field that doesn't exist yet.
  2. Go to an entry and select 'Add an asset"
  3. The modal window that pops up is blank with no upload options.

Expected behavior

When you select to upload a file, If the folder name doesn't exist then one is created and the file is put in that folder.

Actual behavior

The modal window that pops up is blank with no upload options.

Craft CMS version

5.4.4

PHP version

8.2

Operating system and version

Linux 6.10.4-linuxkit

Database type and version

Mariadb 10.6

Image driver and version

Imagick 3.7.0 (ImageMagick 6.9.11-60)

Installed plugins and versions

  • CKEditor 4.2.0
  • Contact Form 3.1.0
  • Feed Me 6.3.0
  • Image Resizer 4.0.1
  • Maps 5.0.3
  • Obfuscator 1.2.0
@i-just
Copy link
Contributor

i-just commented Sep 23, 2024

Hi, thanks for reporting! I raised a PR for this.

@brandonkelly
Copy link
Member

Craft 5.4.5 is out with that fix. Thanks again!

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

No branches or pull requests

3 participants