Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Don't break when docProps/core.xml contains <cp:contentType />#536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
guyonroche merged 2 commits intoexceljs:masterfrompeakon:feature/contentType
Apr 11, 2018

Conversation

@papandreou
Copy link
Contributor

@papandreoupapandreou commentedApr 9, 2018
edited
Loading

I've encountered a spreadsheet that contains:

<cp:coreProperties ...>...<cp:contentType /></cp:coreProperties>

which causes exceljs to break with:

(node:4149) Error: Unexpected xml node in parseOpen: {"name":"cp:contentType","attributes":{},"isSelfClosing":true}    at module.exports.parseOpen (/Users/andreaslind/work/exceljs/lib/xlsx/xform/core/core-xform.js:87:15)    at SAXStream.<anonymous> (/Users/andreaslind/work/exceljs/lib/xlsx/xform/base-xform.js:67:16)    at emitOne (events.js:116:13)    at SAXStream.emit (events.js:211:7)    at SAXParser.me._parser.(anonymous function) [as onopentag] (/Users/andreaslind/work/exceljs/node_modules/sax/lib/sax.js:258:17)    at emit (/Users/andreaslind/work/exceljs/node_modules/sax/lib/sax.js:624:35)    at emitNode (/Users/andreaslind/work/exceljs/node_modules/sax/lib/sax.js:629:5)    at openTag (/Users/andreaslind/work/exceljs/node_modules/sax/lib/sax.js:825:5)    at SAXParser.write (/Users/andreaslind/work/exceljs/node_modules/sax/lib/sax.js:1292:13)    at SAXStream.write (/Users/andreaslind/work/exceljs/node_modules/sax/lib/sax.js:239:18)(node:4149) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.    at emitWarning (internal/process/promises.js:78:15)    at emitPendingUnhandledRejections (internal/process/promises.js:95:11)    at runMicrotasksCallback (internal/process/next_tick.js:124:9)    at _combinedTickCallback (internal/process/next_tick.js:131:7)    at process._tickCallback (internal/process/next_tick.js:180:9)

Unfortunately I'm not able to share the spreadsheet that this happened with, and I don't know how it was created. If it's important I can try to create a synthetic test case with this construct in it.

'cp:revision':newDateXform({tag:'cp:revision'}),
'cp:version':newStringXform({tag:'cp:version'}),
'cp:contentStatus':newStringXform({tag:'cp:contentStatus'}),
'cp:contentType':newDateXform({tag:'cp:contentType'}),
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

I would think this should be aStringXform?

Copy link
ContributorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Ah, you're right, nice catch. I had that originally, but started playing around because that enfant terrible spreadsheet still didn't parse :)

Fixed.

@papandreoupapandreouforce-pushed thefeature/contentType branch 2 times, most recently from1eaede2 to3b46510CompareApril 9, 2018 18:37
@papandreou
Copy link
ContributorAuthor

I just learned that the Excel file in question is an export fromXero, which is a piece of accounting software.

<cp:coreProperties ...><cp:contentType /></cp:coreProperties>
@papandreou
Copy link
ContributorAuthor

I guess the<cp:contentType> element is something they made up, since we haven't seen it until now. Maybe a better strategy would be to ignore these weird extra metadata elements rather than throw?

@salterok
Copy link

I also see documents with<cp:contentType />. And there are many of them.
Instead of error on unknown elements better to just display warning or ignore them completely.

There is example of a such file
1519293514-KRISHNAPATNAM_LINE_UP.xlsx

@papandreou
Copy link
ContributorAuthor

@salterok, thanks for weighing in! I've added a regression test based on the file that you linked to.

@guyonrocheguyonroche merged commite489525 intoexceljs:masterApr 11, 2018
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

1 more reviewer

@holmholmholm left review comments

Reviewers whose approvals may not affect merge requirements

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

4 participants

@papandreou@salterok@holm@guyonroche

[8]ページ先頭

©2009-2025 Movatter.jp