decap-cms
decap-cms copied to clipboard
File widget ignores its own media_folder and instead uses media_folder from the root
trafficstars
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
- Create the following
config.yml:
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
- Go to administration > Files and uplad a file
- See that it was uploaded to
src/assets/uploadsand notpublic/uploads
Applicable Versions:
- Decap CMS version: 3.4.0
- Git provider: GitLab
- Node.JS version: 23.3