Netlify-cms - files disappear after saving and editing

I’ve got a persistent issue with netlify-cms:

If I create a post, save it, and publish it immediately, all works fine. BUT if I create a post, save it, then edit it again before publishing, any uploaded files are overwritten and deleted in the second commit.

  • Create a post with an uploaded file
  • Save the post - commit appears on github correctly
  • Edit the post
  • Save the post again - commit appears in github, but file has been removed

However, post-publication editing seems to work just fine.

I’m trying to create a minimal reproduction as the repo is private, but no luck recreating the issue so far. I’ll update this post with the results if I manage it. In the meantime, here is my config

backend:
  name: git-gateway
  repo: XXXX
  branch: master
  commit_messages:
    create: "Create {{collection}} “{{slug}}”"
    update: "Update {{collection}} “{{slug}}”"
    delete: "Delete {{collection}} “{{slug}}”"
    uploadMedia: "[skip ci] Upload “{{path}}”"
    deleteMedia: "[skip ci] Delete “{{path}}”"

publish_mode: editorial_workflow
media_folder: static/img
public_folder: /img
show_preview_links: false

"gatsby-plugin-netlify-cms": "^4.1.6",

Obviously this might not be possible to diagnose without a reproduction, but I’m just wondering if anyone’s had a similar issue, as I’m tearing my hair out!

Hi @rub1e :wave:

As you mentioned it is hard to figure without a reproduction. I can only recommend:

  1. Clear browser cache.
  2. Update to latest versions of CMS and Gatsby Plugin.
  3. Open an issue here https://github.com/netlify/netlify-cms/issues/new?labels=type%3A+bug&template=bug_report.md&title=Please+replace+with+a+clear+and+descriptive+title, fill out the template and additionally share the browser network requests while saving the post again (the save that deletes the file).