Handle multi-line XML declaration
This commit is contained in:
1 parent
63cd8dd2de
commit
a91dbe5021
1 file changed
+2
-2
+2
-2
@@ -57,9 +57,9 @@ export function parseXmlDeclaration(buffer: Buffer): Attribute[] {
|
|||||||
for (const enc of encodings) {
|
for (const enc of encodings) {
|
||||||
let str = buffer.toString(enc, 0, 150);
|
let str = buffer.toString(enc, 0, 150);
|
||||||
if (str.startsWith("<?xml")) {
|
if (str.startsWith("<?xml")) {
|
||||||
str = str.split("\n")[0].trim();
|
str = str.slice(0, str.indexOf("?>"));
|
||||||
try {
|
try {
|
||||||
return parseAttrs(str.slice(5, -2));
|
return parseAttrs(str.slice(5));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
// Ignore
|
// Ignore
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user