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

Bad thumbnail handling #12423

Open
etj opened this issue Jul 16, 2024 · 1 comment
Open

Bad thumbnail handling #12423

etj opened this issue Jul 16, 2024 · 1 comment

Comments

@etj
Copy link
Contributor

etj commented Jul 16, 2024

Expected Behavior

  • A single thumbnail file should be generated when a Resource is created.
  • The thumbnail file should be removed when the Resource is deleted.

Actual Behavior

When a Document is created, two files are created, e.g.:

-rw-r--r-- 1 root root 17135 Jul 16 07:11 document-886bda39-8560-40b2-b9a0-66104147b254-thumb-e5a132a7-57b7-43d2-bcf0-52d4af6fe3e0.jpg
-rw-r--r-- 1 root root 17135 Jul 16 07:11 document-886bda39-8560-40b2-b9a0-66104147b254-thumb-e5a132a7-57b7-43d2-bcf0-52d4af6fe3e0_3ClS2qX.jpg

When the Document is removed, the files are kept.

Other Resource types should be checked.

Steps to Reproduce the Problem

  1. Create a Document
  2. Check the thumbnail dir for files containing the resource UUID
  3. Remove the Document
  4. Check if the files still exist (they do)

Specifications

  • GeoNode version: master (as of 20240716)
@mattiagiupponi
Copy link
Contributor

mattiagiupponi commented Jul 16, 2024

The thumb is saved twice. The first time here:

actual_name = storage_manager.save(upload_path, ContentFile(image))

Then again after cropping:

geonode/geonode/base/models.py

Lines 1574 to 1576 in 4b6d872

with open(tmp_location, "rb+") as img:
# Saving the img via storage manager
storage_manager.save(storage_manager.path(upload_path), img)

This is valid for all the resources not only documents. Still to be analyzed why is not deleted

@giohappy giohappy modified the milestones: 4.4.0, 5.0.0 Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants