Handle multi-line XML declaration

This commit is contained in:
Zaid Abdulla committed 2020-12-08 02:06:55 -08:00
1 parent 63cd8dd2de
commit a91dbe5021
1 file changed
+2 -2
+2 -2
View File
@@ -57,9 +57,9 @@ export function parseXmlDeclaration(buffer: Buffer): Attribute[] {
for (const enc of encodings) {
let str = buffer.toString(enc, 0, 150);
if (str.startsWith("<?xml")) {
str = str.split("\n")[0].trim();
str = str.slice(0, str.indexOf("?>"));
try {
return parseAttrs(str.slice(5, -2));
return parseAttrs(str.slice(5));
} catch (err) {
// Ignore
}