BUG? - Nullable image field returns a default image

image field of a certain model is nullable, at frontend based on the availability we do show the image, But dato cms automatically response a default image URL, so we can’t do proper nullability check. image.url and image.responsiveImage.src both have this same weird behavior!!

hello @rislam can you please share a full GraphQL query that you are running so that I can double check? If the image is null we shouldn’t send anything.

Here is the GraphQL query

query MyQuery {
  article(filter: {id: {eq: "64083307"}}) {
    _modelApiKey
    id
    coverImage {
      responsiveImage {
        src
        srcSet
        webpSrcSet
        title
        alt
        sizes
      }
      alt
      title
      url
      size
      height
      width
    }
  }
}

and this is the response

{
  "data": {
    "article": {
      "_modelApiKey": "article",
      "id": "64083307",
      "coverImage": {
        "responsiveImage": {
          "src": "https://www.datocms-assets.com/55942/1633495075-blank.png",
          "srcSet": "https://www.datocms-assets.com/55942/1633495075-blank.png 1w",
          "webpSrcSet": "https://www.datocms-assets.com/55942/1633495075-blank.png?fm=webp 1w",
          "title": null,
          "alt": null,
          "sizes": "(max-width: 1px) 100vw, 1px"
        },
        "alt": null,
        "title": null,
        "url": "https://www.datocms-assets.com/55942/1633495075-blank.png",
        "size": 68,
        "height": 1,
        "width": 1
      }
    }
  }
}

Hey @rislam we don’t set any default picture, it must be someone uploading that.

Can you also share the project URL so that I can check what’s going on in your CMS?

ok, I see. Let me check from our end.

Sorry Mat, looks like it’s on our end.

1 Like