decap-cms: Cloudinary per field configuration doesn't work

Hi!

Describe the bug I’m using Cloudinary as my media library. I want to set output_filename_only: false for all fields globally and enable it on specific fields but it only works globally.

With the config below I always get the full url.

Expected behavior I would expect to define a global value for how the output of files should look like and change it on specific fields. At least thats how I understand the documentation.

The Cloudinary media library integration can be configured in two ways: globally and per field https://www.netlifycms.org/docs/cloudinary/#cloudinary-configuration-options

In my example I’d expect a full url in the body field and only the file name in the image field

Applicable Versions:

  • Netlify CMS version: netlify-cms 2.3.3
  • Git provider:GitHub
  • OS: macOS High Sierra
  • Browser version Firefox Nightlx

CMS configuration

media_library:
  name: cloudinary
  output_filename_only: false
  config:
    cloud_name: my_name
    api_key: 1234567890

collections:
  - name: 'til' 
    label: 'TIL' 
    folder: 'til' 
    create: true
    slug: '{{slug}}' 
    fields:
      - { label: 'Body', name: 'body', widget: 'markdown', required: false }
      - { label: 'Image', name: 'image', widget: 'image', required: false, media_library: { output_filename_only: true }  }

Thank you!

About this issue

  • Original URL
  • State: open
  • Created 5 years ago
  • Reactions: 9
  • Comments: 16 (7 by maintainers)

Most upvoted comments

I’m using neflify CMS version 2.9.7 and I’m having problems setting output_file_name globally. Saves the whole url instead of just the filename. Thanks!

Not unsupported, just needs someone to dig in and work out a fix (the good first issue label will hopefully get more eyes on it).

Note for anyone attempting a fix: a few different things are being called out here - for example, an earlier comment stated that setting output_filename_only is not working globally, which isn’t a per-field configuration problem. Might be a general bug with the arguments passed to insertHandler().

Looks like this was never supported (I think the docs are a bit confusing about that) as the options used by insertHandler here: https://github.com/netlify/netlify-cms/blob/b151bdfd7311472eaa1861e9fc17546a3658a083/packages/netlify-cms-media-library-cloudinary/src/index.js#L62 are only taken from the top level config. We should probably update them per field configuration similar to allowMultiple here: https://github.com/netlify/netlify-cms/blob/b151bdfd7311472eaa1861e9fc17546a3658a083/packages/netlify-cms-media-library-cloudinary/src/index.js#L69

@erquhart I still have the issue, output_filename_only: true to image field or any custom transformation for image field doesnt work at all.

Having the same issue. Setting output_file_name to true globally doesn’t help either.