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

WP Stories: relaxing the HEADING_END definition to avoid IOB #14465

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class SaveStoryGutenbergBlockUseCase @Inject constructor(
while (storyBlockStartIndex > -1 && storyBlockStartIndex < content.length) {
storyBlockStartIndex = content.indexOf(HEADING_START, storyBlockStartIndex)
if (storyBlockStartIndex > -1) {
val storyBlockEndIndex = content.indexOf(HEADING_END, storyBlockStartIndex)
val storyBlockEndIndex = content.indexOf(HEADING_END_NO_NEW_LINE, storyBlockStartIndex)
try {
val jsonString: String = content.substring(
storyBlockStartIndex + HEADING_START.length,
Expand Down Expand Up @@ -248,6 +248,7 @@ class SaveStoryGutenbergBlockUseCase @Inject constructor(
const val TEMPORARY_ID_PREFIX = "tempid-"
const val HEADING_START = "<!-- wp:jetpack/story "
const val HEADING_END = " -->\n"
const val HEADING_END_NO_NEW_LINE = " -->"
const val DIV_PART = "<div class=\"wp-story wp-block-jetpack-story\"></div>\n"
const val CLOSING_TAG = "<!-- /wp:jetpack/story -->"
}
Expand Down