Skip to content

CMS allows user to delete a 'required' image and breaks build  #4387

@thissammarshall

Description

@thissammarshall

Describe the bug

I have created a CMS for a client with an image field that is required. If the client attempts to edit an existing CMS entry they are able to delete that required image and click update without the CMS warning that field is required.

To Reproduce

Add a list of images and mark field as required. Upload a CMS entry, edit the entry, delete the image, click update

Expected behavior

Expect that if a required image field is deleted and accidentally left empty then normal 'required' validation should be present

Screenshots

Applicable Versions:

  • Netlify CMS version: 2.12.16
  • Git provider: GitHub
  • OS: MacOS Catalina
  • Node.JS version: 11.15.0

CMS configuration

`backend:
name: git-gateway
branch: master

public_folder: static/images
media_folder: /images

display_url: https://blah.netlify.com/

collections:

  • name: "listingUpload"
    label: "Add/edit listing"
    folder: "src/data/listings"
    create: true
    extension: "json"
    format: "json"
    summary: "{{subNum}} {{streetNum}} {{streetName}} {{suburb}}"
    identifier_field: summary
    media_folder: ""
    public_folder: ""
    fields:
    ** inapplicable fields removed for brevity**
    • {
      label: "Images",
      name: "images",
      widget: "list",
      hint: "Important: At least one image is required",
      field: { label: "Image", name: "image", widget: "image" },
      }
      `

Additional context

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