{{ dirname }} placeholder not set for `public_folder` when initially creating a entry in a nested collection
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
### Describe the bug
When creating an entry in a nested collection, the `{{ dirname }}` placeholder appears to not be set for `public_folder`.
Using the following collection:
```yaml
- label: Dokumentmappar
label_singular: Dokumentmapp
name: documents
folder: src/dokument/
create: true
nested:
summary: "{{ fields.title }}"
depth: 10
fields:
- {label: Titel, name: title}
- {label: Anteckningar, name: body, widget: markdown, required: false}
- {name: permalink, widget: hidden, default: false}
- label: Dokument
name: files
widget: list
summary: "{{ fields.file }}"
field:
name: file
widget: file
media_folder: "/src/dokument/{{ dirname }}"
public_folder: "/dokument/{{ dirname }}"
```
this causes the file paths for `public_folder` to get improperly set, despite the files getting placed correctly by the `media_folder` attribute.
### To Reproduce
1. Use the above collection configuration.
2. Create a nested entry with files attached.
3. Notice that the filepaths set in the .md file is `/dokument/filename.ext` instead of `/dokument/nested/filename.ext`
4. Notice that the files are in the correct position, and editing the nested entry yields the correct paths.
### Expected behavior
Files created should have their filepaths correctly set.
### Screenshots
n/a
### Applicable Versions:
- Decap CMS version: 3.10.1
- Git provider: GitLab
- OS: Ubuntu
- Browser version: Mozilla Firefox 148.0
- Node.JS version: v22.22.1
### CMS configuration
https://git.ludd.ltu.se/lulespexet/www/-/blob/master/src/admin/config.yml
### Additional context
Example commit: https://git.ludd.ltu.se/lulespexet/www/-/commit/ba5b2f6ae8cd03081fe3ab21ecd813f911d7dda5
Contributor guide
Research direction
Start with the linked CMS configuration and reproduce creation of a nested entry using the nested collection and file widget settings shown in the issue. Compare the generated Markdown path with the path after editing the entry; done means the initial creation uses the nested directory in the public file path, matching the media location.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 48/100