SmileyChris / easy-thumbnails

Easy thumbnails for Django
http://easy-thumbnails.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
1.37k stars 312 forks source link

fix #516: thumbnail_cleanup command for S3 and different source storages #562

Open PetrDlouhy opened 3 years ago

PetrDlouhy commented 3 years ago

I was able to make partial fix for #516.

It enables thumbnail_cleanup to work correctly with S3 stoarges and works with different source and destination storage.

The default source storage is now set to DEFAULT_FILE_STORAGE (which is probably better choice in case when the source and destination storages differ), and can be changed by the management command --source-storage parameter. It also adds check for the source storage hash, and if the hashes differ, it only prints warning, but take no action.

May be we could detect all possible storages and compare their hashes with the source.storage_hash value. But I am not sure, if I can load all storage options from settings. The situation would be much easier, if the storage classpath string is stored directly in the Source objects.

Also this change doesn't cove cases, when user wants to change the source storages. In such cases it might be useful either to change the source hash or to delete the thumbnail reference based on users requirements.

DmytroLitvinov commented 1 year ago

Hi there. We have integrated AWS S3 storage also and struggled with the same issue. Is any help needed for merging that PR? I am open to help here.

jrief commented 1 year ago

Is there a way to test this? Since that might be impossible, at least, I'd like to see some documentation on this topic.

PetrDlouhy commented 1 year ago

@jrief Maybe at least some testing could be added. When I would make the tests, I would like to establish coverage collection first. Do you agree with the choice of Codecov?