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

Paperclip would not delete original file if attachment_processing=true #50

Open
cryo28 opened this issue Nov 16, 2011 · 0 comments
Open

Comments

@cryo28
Copy link

cryo28 commented Nov 16, 2011

Paperclip uses Paperclip::Attachment#most_appropriate_url when populating @queue_for_delete with filenames to be deleted if a instance with attachment is destroyed.

However this method is overriden by delayed_paperclip.

In case of

  • A new attachment is assigned to model instance
  • model is saved (:original style file is stored at the location specified by :path) and a new job to make styles is put into resque queue
  • The model is attempted to be destroyed when worker has not yet generated styles (attachment_processing=true)

Paperclip will not delete original-style file because #most_appropriate_url will return the missing.png url. (I'd like to focus, the instance is not dirty, has an id, file is stored at its correct location, but attachment_processing=true).

This orphaned original-style file will be on stored filesystem forever (untill it is manually removed).

Probably Paperclip::Attachment#url should be also overriden to pass style_name attribute to most_appropriate_url, which would return correct interpolation string if the instance is not dirty and requested style is :original.

malandrina pushed a commit to hoteltonight/delayed_paperclip that referenced this issue Feb 21, 2014
Add information about Sidekiq to README
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

No branches or pull requests

1 participant