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

Plugin images are lost when publishing #22

Closed
sveetch opened this issue May 20, 2023 · 1 comment
Closed

Plugin images are lost when publishing #22

sveetch opened this issue May 20, 2023 · 1 comment
Labels

Comments

@sveetch
Copy link
Member

sveetch commented May 20, 2023

Describe the bug
When publishing a page, blocks plugins can lost their images sources.

To Reproduce
Steps to reproduce the behavior:

  1. Create a two Card plugins in a page, both with images;
  2. Publish the page;
  3. Go back to page edition:
  4. Edit only one of the Card plugin, change its images;
  5. Publish the page again;
  6. The card plugin which has not been edited has lost its image source;

Expected behavior
Image sources from plugin should never been removed if user does not have explicitly cleared them.

Desktop (If applicable):

  • OS: Any
  • Browser: Any
  • Version: Any

Versions:

  • Python: Any
  • Django: Any
  • DjangoCMS: Any

Additional context
This is related to the DjangoCMS way to manage published/draft version, published page use cloned plugin from draft and the previous ones are deleted, which trigger the post_delete signal. The receiver auto_purge_files_on_delete can not know about this cloning method and so legitimately remove files during deletion, even files are used in clones plugin in published page.

I've digged a little on this but DjangoCMS does not seems to pass any useful argument to receiver to know if file purge should be done or not. For true this would be possible but would require making additional queries to retrieved involved object and pages to determine if file is used or not, this seems bloated.

At this point, the only workaround is to remove receiver auto_purge_files_on_delete from all plugins.

@sveetch sveetch added the bug label May 20, 2023
sveetch added a commit that referenced this issue May 20, 2023
sveetch added a commit that referenced this issue May 20, 2023
@sveetch
Copy link
Member Author

sveetch commented May 20, 2023

Receiver auto_purge_files_on_delete has been removed from all plugin models in 1.1.0-pre.3

@sveetch sveetch closed this as completed May 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant