question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cloudinary using a string value instead of an array when selecting a single image

See original GitHub issue

Describe the bug This issue is the same as the one described here #2573

When selecting 2 images via Cloudinary media_library, the image strings are saved in markdown as an array. When selecting 1 image, it is saved in markdown as a string.

To Reproduce

  1. Use the following configuration
backend:
  name: git-gateway
  branch: master

local_backend: true

media_library:
  name: cloudinary
  config:
    cloud_name: #REPLACE-THIS
    api_key: #REPLACE-THIS

media_folder: static/img
public_folder: /img

collections:
  - name: "items"
    editor:
      preview: false
    label: "items"
    folder: "content/items"
    create: true
    slug: "{{slug}}"
    fields:
      - { label: "Name", name: "title", widget: "string" }
      - label: "multiple images"
        name: "images"
        widget: "image"
        media_library:
          config:
            multiple: true
      
  1. Create a new item with two images
  2. Create a new item with a single image
  3. You should have 2 new files
---
title: One
images:
 - https://res.cloudinary.com/chromjs/image/upload/v1623377465/laptop1_xzo5ac.jpg
 - https://res.cloudinary.com/chromjs/image/upload/v1623194500/sample.jpg
---
---
title: Two
images: https://res.cloudinary.com/chromjs/image/upload/v1623377465/laptop1_xzo5ac.jpg
---

Expected behavior Item “Two” should be an array of a single item

I created a repo with the minimal configuration: https://github.com/chromjs/cloudinary_array_issue

Applicable Versions:

    "gatsby": "^3.13.0",
    "gatsby-plugin-netlify-cms": "^5.13.0",
    "netlify-cms-app": "^2.15.44",
    "netlify-cms-media-library-cloudinary": "^1.3.10",
    "react": "^17.0.1",
    "react-dom": "^17.0.1"

CMS configuration

backend:
  name: git-gateway
  branch: master

local_backend: true

media_library:
  name: cloudinary
  config:
    cloud_name: #REPLACE-THIS
    api_key: #REPLACE-THIS

media_folder: static/img
public_folder: /img

collections:
  - name: "items"
    editor:
      preview: false
    label: "items"
    folder: "content/items"
    create: true
    slug: "{{slug}}"
    fields:
      - { label: "Name", name: "title", widget: "string" }
      - label: "multiple images"
        name: "images"
        widget: "image"
        media_library:
          config:
            multiple: true
      

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
erezrokahcommented, Oct 5, 2021

Thanks @deepto98, I think @mtfoley shared the current code location to get you started.

Also see our contribution guide here https://github.com/netlify/netlify-cms/blob/master/CONTRIBUTING.md

0reactions
yash431gargcommented, Dec 27, 2022

Hi @erezrokah, Can I help you with this issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Programmatically Uploading Images, Videos, and Other Files
You can either upload using Cloudinary's REST API or one of Cloudinary's client libraries (SDKs), which wrap the upload API and simplify ...
Read more >
Advanced URL Options for Media Asset Delivery - Cloudinary
Learn about Cloudinary's advanced URL options for delivering your media assets, such as special CDN options, placeholders and delivery URL ...
Read more >
Image Transformations for Developers - Cloudinary
Learn how to dynamically transform images with one line of code: crop, resize, ... using a user-defined variable for the text string value....
Read more >
Upload API Reference - Cloudinary
For example, you can use the following SDK command to create an image asset saved to your Cloudinary product environment from a string...
Read more >
Upload Widget API reference - Cloudinary
searchBySites, Array of strings, The URLs of sites to allow for Image Search. If more than one site is given, the Search by...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found