craftcms / cms

Build bespoke content experiences with Craft.
https://craftcms.com
Other
3.22k stars 625 forks source link

Slug based folder structure when not using title field #14036

Open josh-attwood opened 9 months ago

josh-attwood commented 9 months ago

Description

I am having an issue with the folder structure in assets in certain scenarios. For certain projects I quite often set the default asset upload location as the {slug} of the the entry to make it a little bit more manageable. I am having an issue on a site currently where I am not using the title field and instead using custom 'firstName' and 'lastName' fields. When I create a new entry and haven't yet saved the entry, any uploaded assets seem to generate a temp folder and get uploaded there instead of under the slug. This is only an issue when not using the title field.

Screenshot 2023-11-16 at 16 13 40

Steps to reproduce

  1. Create a section which uses alternative plain text fields instead of title field
  2. Add an asset field which uses the {slug} as the default folder structure
  3. Create a new entry
  4. Before saving the new entry add an image to the asset field

Additional info

brandonkelly commented 8 months ago

Where would you expect the assets to be placed?