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

Added error handling for ENAMETOOLONG import error #16054

Merged
merged 3 commits into from
Jan 18, 2023

Conversation

SimonBackx
Copy link
Contributor

@SimonBackx SimonBackx commented Jan 2, 2023

fixes https://github.com/TryGhost/Team/issues/2200

When zipping a folder that contains files with UTF-8 characters in the filename, using the MacOS Archive Utility, the resulting zip will be missing some UTF-8 configuration bit. This breaks the unzipper, causing it to decode the filenames using the wrong encodign.

When the file names are long, and become longer than the length allowed by the OS, an ENAMETOOLONG error is thrown. This error is not handled by the importer, and causes the import to fail.

This adds a specific check for this error so we can show a clear error message to the user, that helps them to resolve the issue. We are currently unable to fix the issue on our side, because of a lack of well supported zip libraries for node.

@SimonBackx SimonBackx force-pushed the enametoolong-import-error branch from 838531e to e7c6289 Compare January 2, 2023 10:05
@codecov
Copy link

codecov bot commented Jan 2, 2023

Codecov Report

Base: 70.55% // Head: 70.54% // Decreases project coverage by -0.01% ⚠️

Coverage data is based on head (12f320a) compared to base (f568b35).
Patch coverage: 30.76% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16054      +/-   ##
==========================================
- Coverage   70.55%   70.54%   -0.02%     
==========================================
  Files        1706     1706              
  Lines      108333   108357      +24     
  Branches    16130    16135       +5     
==========================================
+ Hits        76435    76441       +6     
- Misses      30607    30624      +17     
- Partials     1291     1292       +1     
Flag Coverage Δ
e2e-tests 85.11% <23.80%> (-0.05%) ⬇️
unit-tests 53.80% <30.76%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
ghost/admin/app/components/modal-import-content.js 2.17% <0.00%> (-0.10%) ⬇️
ghost/admin/app/services/ajax.js 76.27% <0.00%> (-1.77%) ⬇️
...t/core/core/server/data/importer/import-manager.js 89.35% <38.09%> (-2.29%) ⬇️
ghost/admin/app/helpers/gh-price-amount.js 44.44% <0.00%> (-22.23%) ⬇️
...ata-generator/lib/tables/members-created-events.js 85.71% <0.00%> (-8.58%) ⬇️
ghost/admin/app/components/gh-site-iframe.js 45.45% <0.00%> (-6.82%) ⬇️
ghost/core/core/app.js 80.00% <0.00%> (-2.50%) ⬇️
ghost/data-generator/lib/data-generator.js 72.67% <0.00%> (-0.22%) ⬇️
... and 6 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

fixes https://github.com/TryGhost/Team/issues/2200

When zipping a folder that contains files with UTF-8 characters in the filename, using the MacOS Archive Utility, the resulting zip will be missing some UTF-8 configuration bit. This breaks the unzipper, causing it to decode the filenames using the wrong encodign.

When the file names are long, and become longer than the length allowed by the OS, an ENAMETOOLONG error is thrown. This error is not handled by the importer, and causes the import to fail.

This adds a specific check for this error so we can show a clear error message to the user, that helps them to resolve the issue. We are currently unable to fix the issue on our side, because of a lack of well supported zip libraries for node.
@SimonBackx SimonBackx force-pushed the enametoolong-import-error branch from e7c6289 to 99c76ed Compare January 2, 2023 10:19
@SimonBackx SimonBackx marked this pull request as ready for review January 2, 2023 10:21
@SimonBackx SimonBackx requested a review from ErisDS January 2, 2023 10:21
Copy link
Member

@ErisDS ErisDS left a comment

Choose a reason for hiding this comment

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

Have added some notes to the issue :)

@SimonBackx SimonBackx requested a review from ErisDS January 2, 2023 15:36
@SimonBackx SimonBackx force-pushed the enametoolong-import-error branch from 3f377c5 to 29ded55 Compare January 2, 2023 15:42
@SimonBackx
Copy link
Contributor Author

@ErisDS Could you give this another look? 😊

@SimonBackx SimonBackx merged commit 4d54880 into TryGhost:main Jan 18, 2023
@SimonBackx SimonBackx deleted the enametoolong-import-error branch January 18, 2023 12:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants