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

Fix persist with missing body from file (regression from #759) #808

Merged
merged 1 commit into from
Nov 11, 2017

Conversation

ebello
Copy link
Contributor

@ebello ebello commented Nov 11, 2017

- Summary
Trying to save a page that does not have a value for body results in an error. This is a regression from #759, which removed the default value for body.

- Test plan
If you try to save the Kitchen Sink entry you'll end up with the following error:

Uncaught TypeError: Cannot read property 'content' of undefined
    at module.exports (stringify.js?2ea5:23)
    at Function.matter.stringify (index.js?1c62:131)
    at Object.toFile (frontmatter.js?cfa9:57)
    at Backend.entryToRaw (backend.js?bb12:303)
    at Backend.persistEntry (backend.js?bb12:239)
    at eval (entries.js?c1a9:300)
    at eval (index.js?8bff:9)
    at eval (bindActionCreators.js?45eb:3)
    at eval (EntryPage.js?2e7b:109)

Or run new should stringify YAML with missing body test in frontmatter.spec.js.

- Description for the changelog
Includes a failing test as well as initiates body with an empty string if not available from page data.

- A picture of a cute animal (not mandatory but encouraged)

Copy link
Contributor

@tech4him1 tech4him1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. We were actually discussing this on the chat right now, so it's awesome timing!

@tech4him1 tech4him1 merged commit 0183ad4 into decaporg:master Nov 11, 2017
@tech4him1
Copy link
Contributor

tech4him1 commented Nov 11, 2017

@ebello Can you add yourself to our contributors list? Instructions here: https://github.com/netlify/netlify-cms/blob/master/CONTRIBUTING.md#add-yourself-as-a-contributor

@erquhart
Copy link
Contributor

Oh, I thought this fix was from you @tech4him1 - thanks for this @ebello!! Definitely add yourself to the contributors list!

@ebello ebello mentioned this pull request Nov 11, 2017
@ebello
Copy link
Contributor Author

ebello commented Nov 11, 2017

Thanks guys! I just did so, hopefully I did it correctly.

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

Successfully merging this pull request may close these issues.

3 participants