Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Take CR/LF into account when separating content from YAML metadata #471
@Fjan the fix is indeed to add
How not limiting the split could mess up a file that has
@ddfreyne which do you prefer?
Tell me and I'll update the PR accordingly.
referenced this pull request
Aug 21, 2014
@gpakosz You are right, I see the content will not be messed up because although it might split unnecessarily it will store the separator and then join it back in. So hacky, but it works. If we choose to avoid the unnecessary split then we can further improve that code by not capturing and storing the split in the first place:
(and then adjust the size check and the indexes of pieces accordingly).
@gpakosz Ok, let's leave the split. However, I just realised the split does not capture the line ending, so if '---' does occur in the rest of the code somewhere the line ending for that line might change, so my initial comment was correct (although a line ending change does not typically cause issues). Anyway, if we simply limit the split to 3, as I see @ddfreyne agrees with, we avoid it altogether.