lutaml-model 0.8.104 → 0.8.105
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/lutaml/model/version.rb +1 -1
- data/lib/lutaml/xml/adapter/xml_parser.rb +0 -43
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: c9d133a4a89e51d9a1ed811bd992faeac4f0a8513e283b46f079707bcc083f7e
|
|
4
|
+
data.tar.gz: e4df7bb98a1f7518bdd9f2194934e91feea5367bbf536f75aa4353a067b65049
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 7040ad58b0a31222207e14245293f8f20eb674180dcd55936de938151f16fc5260615f5ec3244769e4644af0bd6f02c9262e87717cbdff9d578a6b1365bbbb3a
|
|
7
|
+
data.tar.gz: f5d38407f6e5ad1b87bad426f68398a6e1249b57c928aa1a94f0585b144517542f0565c38ad2f53b31bc2c80bdaf63a5425968ba883c9d222508940f9b8b1c17
|
data/lib/lutaml/model/version.rb
CHANGED
|
@@ -20,7 +20,6 @@ module Lutaml
|
|
|
20
20
|
raw_xml = xml
|
|
21
21
|
xml = normalize_xml_for_parse(xml)
|
|
22
22
|
parsed = parse_with_moxml(xml, parse_encoding)
|
|
23
|
-
assert_no_truncated_recovered_parse!(parsed)
|
|
24
23
|
root_element = parsed.root
|
|
25
24
|
|
|
26
25
|
raise_empty_document_error(parsed.parse_errors) if root_element.nil?
|
|
@@ -31,31 +30,6 @@ module Lutaml
|
|
|
31
30
|
new(root, parse_encoding, **parse_document_options(raw_xml))
|
|
32
31
|
end
|
|
33
32
|
|
|
34
|
-
# Recover-mode parsing must never masquerade input truncation as
|
|
35
|
-
# success.
|
|
36
|
-
#
|
|
37
|
-
# moxml releases before 0.5.84 parsed Nokogiri documents without
|
|
38
|
-
# XML_PARSE_HUGE, so libxml2 capped its input buffer at 10 MB;
|
|
39
|
-
# longer documents tripped a fatal "Resource limit exceeded:
|
|
40
|
-
# Buffer size limit exceeded, try XML_PARSE_HUGE" error mid-input.
|
|
41
|
-
# In recover mode Nokogiri records that error on the document and
|
|
42
|
-
# returns the partial tree, so every node past the limit silently
|
|
43
|
-
# vanishes (lutaml-model#871). A resource-limit fatal means the
|
|
44
|
-
# engine stopped early with input left — refuse to deserialize the
|
|
45
|
-
# partial document instead of dropping trailing content without a
|
|
46
|
-
# trace.
|
|
47
|
-
#
|
|
48
|
-
# moxml 0.5.84 and later always pass XML_PARSE_HUGE, so the
|
|
49
|
-
# Nokogiri path no longer truncates and this guard stays silent;
|
|
50
|
-
# it remains for older moxml releases and for any other adapter
|
|
51
|
-
# that reports the resource-limit family.
|
|
52
|
-
#
|
|
53
|
-
# Other recover-mode fatals (e.g. an XML declaration after leading
|
|
54
|
-
# whitespace) do not drop content and keep the long-standing
|
|
55
|
-
# recover behavior; only the resource-limit family is truncating.
|
|
56
|
-
TRUNCATION_FATAL_MARKER =
|
|
57
|
-
/Resource limit exceeded|Buffer size limit exceeded/
|
|
58
|
-
|
|
59
33
|
private
|
|
60
34
|
|
|
61
35
|
def normalize_xml_for_parse(xml)
|
|
@@ -88,23 +62,6 @@ module Lutaml
|
|
|
88
62
|
end
|
|
89
63
|
end
|
|
90
64
|
|
|
91
|
-
def assert_no_truncated_recovered_parse!(parsed)
|
|
92
|
-
errors = parsed.parse_errors
|
|
93
|
-
return if errors.nil? || errors.empty?
|
|
94
|
-
|
|
95
|
-
fatal = errors.find do |message|
|
|
96
|
-
message.match?(TRUNCATION_FATAL_MARKER)
|
|
97
|
-
end
|
|
98
|
-
return if fatal.nil?
|
|
99
|
-
|
|
100
|
-
raise Lutaml::Model::InvalidFormatError.new(
|
|
101
|
-
:xml,
|
|
102
|
-
"the XML engine reported a fatal resource limit and recovered " \
|
|
103
|
-
"with a truncated document; refusing to deserialize " \
|
|
104
|
-
"partial input (#{fatal})",
|
|
105
|
-
)
|
|
106
|
-
end
|
|
107
|
-
|
|
108
65
|
def parse_document_options(xml)
|
|
109
66
|
{
|
|
110
67
|
doctype: extract_doctype_from_xml(xml),
|