-
Notifications
You must be signed in to change notification settings - Fork 45
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
🐛 Use window of correct size in presence of newlines to grab content from xml files #461
Conversation
Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
lines = append(lines, line) | ||
} | ||
// remove leading and trailing empty lines | ||
if len(lines) > 0 && lines[0] == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a time/place where you can have content that is 5 empty lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawn-hurley content comes from innerText returned by the XML search, and it depends on the xml query, so theoritically it's possible if someone is intentionally / mistakenly looking for empty lines. in that case, we will end up showing empty lines as code snip
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What if as we loop, as long as one thing has content, then we use it, if all don't then we skip it?
Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
if len(lines) > 0 && lines[len(lines)-1] == "" { | ||
lines = lines[:len(lines)-1] | ||
} | ||
if len(lines) < 1 || strings.Join(lines, "") == "" { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@shawn-hurley this check should take care of the empty case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
…from xml files (#461) We are stripping out empty lines when doing the search, however, in the window that we load into memory we still have to load these empty lines to be able to correctly search content. We only have to get rid of newlines from beginning and the end. --------- Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
…from xml files (#461) (#462) We are stripping out empty lines when doing the search, however, in the window that we load into memory we still have to load these empty lines to be able to correctly search content. We only have to get rid of newlines from beginning and the end. --------- Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com> Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com> Co-authored-by: Pranav Gaikwad <pgaikwad@redhat.com>
We are stripping out empty lines when doing the search, however, in the window that we load into memory we still have to load these empty lines to be able to correctly search content. We only have to get rid of newlines from beginning and the end.