-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Rescue FileNotFoundError exception on failed image downloads #4026
Conversation
Failed on Paperclip
|
end | ||
|
||
click_button "Update" | ||
Spree::Image.first.attachment.blob.update(key: 11) |
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.
Specs are failing in the CI in jobs where we do not use Active Storage but Paperclip. In that case, attachment
doesn't respond to blob
and it fails.
I think we need to find a way to make this compatible with both or skip the test when we are using Paperclip.
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.
Skipping test based on which module is used.
In rare circumstances, an image would fail to upload to a third party storage service, causing the application to hard crash when trying to retrieve an image resource. This commit implements a fix to return a place holder image to alert the user of an error and also prevents the application from crashing. This fix will not, however, save any errors associated with the failed upload such as credential errors. This fix was tested by artificially changing the blob record to force a FileNotFoundError. Commit History: Implemented fix for AS::FileNotFound Error" Implemented feature test for potential FileNotFoundError Added conditional to test because it is specific to Active Storage
da8ffac
to
af78b4b
Compare
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record. This compliments [PR solidusio#4026](solidusio#4026) which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments [PR solidusio#4026](solidusio#4026) which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata. - metadata returns hash with strings, not symbols caused nil values to be returned regardless if the image was good or not.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata. - metadata returns hash with strings, not symbols caused nil values to be returned regardless if the image was good or not.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata. - metadata returns hash with strings, not symbols. It appeared that this caused nil values to be returned regardless if the image was good or not.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata. - metadata returns hash with strings, not symbols. It appeared that this caused nil values to be returned regardless if the image was good or not.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata. - metadata returns hash with strings, not symbols. It appeared that this caused nil values to be returned regardless if the image was good or not.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
This commit adds the ability for the application to catch missing images with Active Storage during an API call should a file become corrupt or deleted without removing the record through appropriate channels. This compliments PR solidusio#4026 which prevented the same error on the backend. The change will return and image with attributes equal to nil and noimage replacements if an image cannot be sourced. Reasons for the changes: - image.attachment.url bypasses rescue check found in ActiveStorageAdapter - API calls hit height and width prior to url rescue, had to implement rescue in Attachment#metadata.
Description
This PR aimed to solve the Active::Storage::FileNotFoundError bug described in Issue #4017 by to handling FileNotFound error when ActiveStorage fails to download from a remote service such as S3.
In rare circumstances, an image would fail to upload to a third party storage service, causing the application to hard crash when trying to retrieve an image resource. This commit implements a fix to return a place holder image to alert the user of an error and also prevents the application from crashing. This fix will not, however, save any errors associated with the failed upload such as credential errors. This fix was tested by artificially changing the blob record to force
a FileNotFoundError.
The handling of the FileNotFound error maybe a temporary fix as we are aiming to discover another pathway to handle the exception and remove the invalid objects simultaneously.
Checklist: