Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/exceljs/exceljs
Browse files Browse the repository at this point in the history
  • Loading branch information
guyonroche committed May 16, 2019
2 parents 269a4dd + b16751c commit 0cfe51b
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 91 deletions.
13 changes: 7 additions & 6 deletions lib/xlsx/xform/base-xform.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use strict';
"use strict";

const Sax = require('sax');
const PromiseLib = require('../../utils/promise');

const XmlStream = require('../../utils/xml-stream');
const XmlStream = require("../../utils/xml-stream");

/* 'virtual' methods used as a form of documentation */
/* eslint-disable class-methods-use-this */
Expand Down Expand Up @@ -65,25 +65,26 @@ class BaseXform {
const abort = error => {
// Abandon ship! Prevent the parser from consuming any more resources
parser.removeAllListeners();
parser.on("error", () => {}); // Ignore any parse errors from the chunk being processed
stream.unpipe(parser);
reject(error);
};

parser.on('opentag', node => {
parser.on("opentag", node => {
try {
this.parseOpen(node);
} catch (error) {
abort(error);
}
});
parser.on('text', text => {
parser.on("text", text => {
try {
this.parseText(text);
} catch (error) {
abort(error);
}
});
parser.on('closetag', name => {
parser.on("closetag", name => {
try {
if (!this.parseClose(name)) {
resolve(this.model);
Expand All @@ -96,7 +97,7 @@ class BaseXform {
parser.on('end', () => {
resolve(this.model);
});
parser.on('error', error => {
parser.on("error", error => {
abort(error);
});
});
Expand Down
Binary file added spec/integration/data/invalid-xml.xlsx
Binary file not shown.
Loading

0 comments on commit 0cfe51b

Please sign in to comment.