mirror of https://github.com/adamdruppe/arsd.git
strict context went out of bounds
This commit is contained in:
parent
19f6dd989c
commit
e83c016c69
16
dom.d
16
dom.d
|
@ -843,9 +843,11 @@ class Document : FileResource {
|
||||||
selfClosed = true;
|
selfClosed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(strict)
|
import std.algorithm.comparison;
|
||||||
enforce(data[pos] == '>', format("got %s when expecting > (possible missing attribute name)\nContext:\n%s", data[pos], data[pos - 100 .. pos + 100]));
|
|
||||||
else {
|
if(strict) {
|
||||||
|
enforce(data[pos] == '>', format("got %s when expecting > (possible missing attribute name)\nContext:\n%s", data[pos], data[max(0, pos - 100) .. min(data.length, pos + 100)]));
|
||||||
|
} else {
|
||||||
// if we got here, it's probably because a slash was in an
|
// if we got here, it's probably because a slash was in an
|
||||||
// unquoted attribute - don't trust the selfClosed value
|
// unquoted attribute - don't trust the selfClosed value
|
||||||
if(!selfClosed)
|
if(!selfClosed)
|
||||||
|
@ -8893,6 +8895,14 @@ immutable string html = q{
|
||||||
assert(rd.href == "/reviews/8832");
|
assert(rd.href == "/reviews/8832");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
unittest {
|
||||||
|
try {
|
||||||
|
auto doc = new XmlDocument("<testxmlns:foo=\"/\"></test>");
|
||||||
|
} catch(Exception e) {
|
||||||
|
// good; it should throw an exception, not an error.
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Copyright: Adam D. Ruppe, 2010 - 2020
|
Copyright: Adam D. Ruppe, 2010 - 2020
|
||||||
License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
|
License: <a href="http://www.boost.org/LICENSE_1_0.txt">Boost License 1.0</a>.
|
||||||
|
|
Loading…
Reference in New Issue