Closed eviltrout closed 9 years ago
Can you give an example of what the input array looks like that triggers this case?
The difficult part with this PR is it depends on the Discourse extension shoving JsonML in there before it gets to this list parsing bit.
The Discourse check ends up putting a token in there that is a string, like "evil trout", where the list parsing expects an array. So the shift() ends up undefined. However without the shift, everything works as expected as the string is concated to the end of the list JsonML.
My concern here is that we're changing the already ugliest part of the code for a special case. Can Discourse put it in as ["evil trout"]
instead of "evil trout"
?
At first I thought that was impossible, but it seems I could do it entirely in Discourse's side. Sorry!
Sorry I don't have a test for this, because it's specific to something that Discourse adds in via our custom formatting.
Essentially the issue is
firstBlock
can be aString
sometimes, and in that case we don't want to shift it, we just want to append it. All grunt tests pass and this fixes the issue in Discourse.Thanks!