Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
saulchavezr opened this issue Sep 15, 2021 · 7 comments

Comments

@saulchavezr
Copy link

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
      
@saulchavezr saulchavezr added the type: bug code to address defects in shipped code label Sep 15, 2021
@mtfoley
Copy link

mtfoley commented Sep 18, 2021

@deepto98
Copy link

deepto98 commented Oct 5, 2021

@erezrokah Hi, I'm new to the Netlify project, I would love to pick this up? Can you assign this to me? Also any pointers I should keep in mind while setting up the project/working on this task, would be helpful.

@erezrokah
Copy link
Contributor

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

@iChenLei
Copy link
Contributor

iChenLei commented Dec 8, 2021

It looks like your config not work.

@yash431garg
Copy link

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

@stale
Copy link

stale bot commented Apr 26, 2023

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

7 participants