Support parsing XML with huge nodes
What does this MR do and why?
- Issue: JUnit feature should be able to parse JUnit.xml files with large nodes
- JiHu issue: https://jihulab.com/gitlab-cn/gitlab/-/issues/3308
The Hash.from_xml
we used does not support parsing XML containing huge nodes. Currently MR changes it to Nokogiri::XML
with HUGE
parameter to solve this problem.
Surprisingly, this not only solves the current bug, but will even improve the speed of parsing xml
MR acceptance checklist
Please evaluate this MR against the MR acceptance checklist. It helps you analyze changes to reduce risks in quality, performance, reliability, security, and maintainability.
Screenshots or screen recordings
No UI changes.
How to set up and validate locally
The Spec spec/lib/gitlab/xml_converter_spec.rb
has clearly tested this process.
huge_xml = URI.open('https://jihulab.com/test-xml-error/project1/-/raw/main/test.xml?ref_type=heads').read
Hash.from_xml(huge_xml) # Error!
doc = Nokogiri::XML(xml, &:huge)
doc.to_hash # Success!
doc.errors # is `[]`!
Edited by Zhiyuan Lu