Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[5.x]: Assets are uploaded to (and remain) in a temp-xxx… folder if {slug} is used in the asset upload path for entry types with auto-generated titles #16799

Open
rungta opened this issue Feb 28, 2025 · 0 comments
Labels

Comments

@rungta
Copy link

rungta commented Feb 28, 2025

What happened?

Description

Craft appears to be delaying auto-generating the slug field until the first Save operation for entry types that don’t use the native title field. This leads to poor AX for asset fields that use {slug} in the upload path.

In the absence of a slug, Craft ends up creating temporary asset folders and any assets uploaded before the first-save end up remaining in these temp-xxx… folders, even after a slug has been generated for the entry (automatically by Craft).

Steps to reproduce

  1. Create an entry type with an auto-generated title using a custom title field (example screenshot below)
  2. Create an asset field with {slug} in the Default Upload Location setting.
  3. Add this asset field to the entry type from step 1.
  4. Create a new entry for the entry type from step 1
    • Upload a file to the asset field from step 2
    • Entry “Foo Bar” in the custom title field
    • Do not manually fill in the slug field
  5. Save the entry

Image
Image
Image

Expected behavior

Expected behavior is that the asset uploaded in step 4 will be saved inside a folder called foo-bar.

Actual behavior

Instead, the asset is found inside a folder called temp_eqzxinrledslkmppbcjqgtbddqemrexmtvem.

Craft CMS version

5.6.5.1

PHP version

8.2

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

@rungta rungta added the bug label Feb 28, 2025
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant