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

Empty page (rendered = '') causes error #11

Open
uuf6429 opened this issue Aug 4, 2022 · 0 comments
Open

Empty page (rendered = '') causes error #11

uuf6429 opened this issue Aug 4, 2022 · 0 comments

Comments

@uuf6429
Copy link

uuf6429 commented Aug 4, 2022

} else if (typeof field_value === 'object' && field_value.rendered) {

If field.value.rendered is an empty string, that condition is skipped and an object is returned, causing the error below inside turndown:

Uncaught TypeError: [object Object] is not a string, or an element/document/fragment node.

A fix would be to check if rendered is actually undefined, eg:

    } else if (typeof field_value === 'object' && field_value.rendered !== undefined) {

Note that this might also apply to line 64 with href.

Edit: I tested the change locally and it seems to work.

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

No branches or pull requests

1 participant