Skip to content

fix(gatsby-source-filesystem): Retry a download if a file is incomplete #28547

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

Merged
merged 3 commits into from
Dec 17, 2020

Conversation

sidharthachatterjee
Copy link
Contributor

When downloading a file from a remote under pressure, we have seen cases where the download might be incomplete, especially in cases of images. Such files will break sharp when it attempts to process them with an Error because they are corrupt.

One (not exhaustive) nice to have check to prevent this is to assert that the bytes written to disk and equal to the Content-Length sent in HTTP headers (when present).

This PR adds that check and retries if the check fails.

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 9, 2020
@sidharthachatterjee sidharthachatterjee removed the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label Dec 9, 2020
mxstbr
mxstbr previously approved these changes Dec 9, 2020
Copy link
Contributor

@mxstbr mxstbr left a comment

Choose a reason for hiding this comment

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

Integration test failures are unrelated, see #27781 for context!

This looks fantastic to me and a lot better for our users 👍

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.

4 participants