Skip to content

File collection with registered uploadcare media_library throws error "params.mediaFolder" is not allowed to be empty #6243

@madsem

Description

@madsem

I made a file collection for site settings, added an image widget for the logo.
My CMS object has uploadcare registered as media_library and it's working throughout the entire site.

But whenever I try to browse to the settings entry, I get this error "params.mediaFolder" is not allowed to be empty.

const settings = {
  name: "settings",
  create: false,
  delete: false,
  label: "Site Settings",
  label_singular: "Site Setting",
  description: "Site Settings: Logo, Global Meta Title etc.",
  files: [
    {
      name: "global_settings",
      label: "Global Settings",
      file: "/site/_data/cms-settings.yml",
      extension: "yml",
      format: "yml",
      fields: [
        {
          label: "Logo",
          name: "logo",
          widget: "image",
          hint: "The global site logo shown in header & footer - **best to use an SVG.**",
          choose_url: false,
        },
        {
          label: "Meta Title",
          name: "title",
          widget: "text",
          hint: "The global meta title.",
        },
        {
          label: "Meta Description",
          name: "description",
          widget: "text",
          hint: "The global meta description.",
        },
      ],
    },
  ],
};

export default settings;

CMS init object:
(xxxxxxx is redacted)

CMS.init({
  config: {
    load_config_file: false,
    backend: {
      name: window.CMS_BACKEND_NAME,
      repo: window.CMS_REPOSITORY,
      branch: window.CMS_BRANCH,
      proxy_url: window.CMS_PROXY_URL ?? null,
      local_backend: window.CMS_LOCAL_BACKEND ?? false,
    },
    editor: {
      preview: false, // until we have an actual custom preview...
    },
    site_url: window.CMS_SITE_URL,
    display_url: window.CMS_DISPLAY_URL,
    publish_mode: window.CMS_PUBLISH_MODE,
    logo_url: "xxxxxxx",
    media_library: {
      name: "uploadcare",
      config: {
        publicKey: window.CMS_UPLOADCARE,
      },
    },
    collections: [
      settings,
      xxxxxxx,
      xxxxxxx,
    ],
  },
});

In any other collection I can upload images np, only the file collection throws this error.

This is unexpected to me and unless I am missing something essential, I believe this is a bug.

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugcode to address defects in shipped code

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions