- Notifications
You must be signed in to change notification settings - Fork1.9k
Don't break when attempting to import a zip file that's not an Excel file (eg. .numbers)#423
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
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters
…readsheet... a .numbers file, for instance.
ContributorAuthor
papandreou commentedNov 6, 2017 via email• edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Hi Michael,Thanks for taking a look!The issue is that `model.properties` doesn't appear to exist when the zipfile isn't structured in a certain way, so `model.properties.date1904` (oreven `model.properties || model.properties.date1904`) will dereferenceundefined and cause:```TypeError: Cannot read property 'date1904' of undefined```... when running the enclosed regression test.Best regards,Andreas …On Mon, Nov 6, 2017 at 8:10 PM, Michael Lelyakin ***@***.***> wrote: ***@***.**** commented on this pull request. ------------------------------ In lib/xlsx/xlsx.js <#423 (comment)>: > @@ -108,7 +108,7 @@ XLSX.prototype = { sharedStrings: model.sharedStrings, media: model.media, mediaIndex: model.mediaIndex, - date1904: model.properties.date1904, + date1904: model.properties && model.properties.date1904, I'm not sure that the meaning of this line of code, but I think that you want to use || operator instead of &&. Are you sure in this line? Can you provide me little clarification for it? :) — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#423 (review)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAWzKcaXrmRmtz7Zs_WWwEMVoLyiURsRks5sz1mVgaJpZM4P90sF> . |
Collaborator
guyonroche commentedNov 20, 2017
Hey Guys, |
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi!
We're running a service that uses exceljs to process uploaded Excel spreadsheets. The other day a user accidentally uploaded a wrongly named .numbers file, which caused an exceljs crash:
I had a quick look, and it seems like .numbers files also use a zip-based container, but since all the entries are differently named compared to .xlsx, some internal state ends up being unintialized, which makes
reconcilebreak.Turns out it was rather easy to just default that state so the file loads, but isn't populated with any worksheets. It would probably be better to reject the promise with a specific error, though. What do you think?