Skip to content
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

Fix extraction of PDF.js package #806

Merged
merged 2 commits into from Aug 21, 2023
Merged

Conversation

danxuliu
Copy link
Member

It seems that in some cases unzipper may not extract all the files (see 278 in https://github.com/ZJONSSON/node-unzipper/issues, not linking directly to avoid polluting it with back references) and, with some node versions, it may corrupt some of the extracted files (see 271 in https://github.com/ZJONSSON/node-unzipper/issues). As there is no fix for all that yet (downgrading unzipper to 0.10.11 might solve the missing extracted files, but it would still be affected by the corrupted files and thus prevent upgrading to a newer node version) unzipper was replaced by adm-zip.

This could explain the strange errors seen when building the PDF viewer, as well as why the UI was broken after updating the node engines (it would not be a problem in the JavaScript files but in the extracted files, which can be noticed for example in viewer.html).

It would explain too the deleted locale files after the bump to PDF.js 3.9.179 (which are fixed in this pull request).

It seems that in some cases "unzipper" may not extract all the files
and, with some node versions, it may corrupt some of the extracted
files. As there is no fix for all that yet (downgrading "unzipper" to
0.10.11 might solve the missing extracted files, but it would still be
affected by the corrupted files and thus prevent upgrading to a newer
node version) "unzipper" was replaced by "adm-zip".

"adm-zip" does not have dependencies and has a large user base.
Unfortunately it does not support streams and requires loading the whole
file in memory to be able to extract it, but the package is not very
large (around 5,5 MiB), so this should not be a problem.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu added bug 3. to review dependencies Pull requests that update a dependency file labels Aug 21, 2023
@danxuliu danxuliu added this to the Nextcloud 28 milestone Aug 21, 2023
@danxuliu danxuliu requested a review from szaimen August 21, 2023 16:19
This was referenced Aug 21, 2023
Copy link
Collaborator

@szaimen szaimen left a comment

Choose a reason for hiding this comment

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

Wow, crazy

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
@danxuliu danxuliu force-pushed the fix-extraction-of-pdf.js-package branch from 0893180 to 16eb2ba Compare August 21, 2023 16:45
@danxuliu
Copy link
Member Author

I have just slightly reworded the commit message, no other changes besides that since the review.

@danxuliu danxuliu merged commit 6a214a9 into master Aug 21, 2023
17 checks passed
@delete-merged-branch delete-merged-branch bot deleted the fix-extraction-of-pdf.js-package branch August 21, 2023 16:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review bug dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants