-
-
Notifications
You must be signed in to change notification settings - Fork 343
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for 3mf #415
Add support for 3mf #415
Conversation
@@ -318,6 +318,13 @@ async function _fromTokenizer(tokenizer) { | |||
}; | |||
} | |||
|
|||
if (zipHeader.filename.startsWith('3D/') && zipHeader.filename.endsWith('.model')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (zipHeader.filename.startsWith('3D/') && zipHeader.filename.endsWith('.model')) { | |
if (zipHeader.filename.startsWith('/3D/') && zipHeader.filename.endsWith('.model')) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's no leading slash in the filenames of any of the zip-based formats. The above will fail.
xlsx has the same implementation: https://github.com/sindresorhus/file-type/blob/master/core.js#L314-L319
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me. Another way, to determine the file, would be search for [Content_Types].xml
, unzip that file, parse the XML, use the content-types. But not feasible in this context, I think this is the best way indeed.
It follows the Open Packaging Conventions, so the detection is very similar to docx or odt.
https://www.iana.org/assignments/media-types/model/3mf