EasyCorp / EasyCorp/EasyAdminBundle

ImageField: image not deleted

Open
#7,763 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
PHP
Stars
4.3k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
11

Description

When an image is deleted (ImageField), the database entry is set to an empty string and the file remains. What does work, however, is replacing an image; in that case, the previous file is deleted.

In FileUploadState $deletedFiles is correctly set, but $delete is false, that seems to be the reason why the file isn't deleted in processUploadedFiles().

EasyAdmin v5.4.1

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing FileUploadState and processUploadedFiles(), where $deletedFiles is set but $delete is false. Reproduce deleting an ImageField value and compare it with replacing an image. Done means the database value becomes empty and the previously uploaded file is removed.

Written by the indexing model from the issue text.

Assessment

Tech stack
php, symfony
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
58/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.