File widget ignores its own media_folder and instead uses media_folder from the root
- Dominant language
- JavaScript
- Stars
- 19.4k
- Forks
- 3.1k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 9
Description
**Describe the bug**
My team is working on a static web page that has a lot of images that are preprocessed by Vite. That's why we have `media_folder: "src/assets/uploads"` in the root of the config (that's where images are supposed to go). Now, we want to add the option to upload files, which should be placed directly in the `public` folder, so we used the `media_library.media_folder` property on the `file` widget – but it is ignored, and the files are uploaded to `src/assets/uploads` instead of `public/uploads`.
**To Reproduce**
1. Create the following `config.yml`:
```yaml
local_backend: false
backend:
name: gitlab
repo: ...
branch: main
auth_type: pkce
api_root: https://gitlab.druit.org/api/v4
base_url: https://gitlab.druit.org
auth_endpoint: oauth/authorize
app_id: ...
locale: cs
publish_mode: simple
media_folder: src/assets/uploads
public_folder: "#uploads"
collections:
- ...
- name: files
label: Files
folder: src/content/files
create: true
fields:
- widget: file
name: file
media_library:
allow_multiple: false
media_folder: public/uploads
```
2. Go to administration > Files and uplad a file
3. See that it was uploaded to `src/assets/uploads` and not `public/uploads`
**Applicable Versions:**
- Decap CMS version: 3.4.0
- Git provider: GitLab
- Node.JS version: 23.3
Contributor guide
Assessment
This issue has not been assessed yet.