Skip to content

Bug: delete-filter updates user-data to early #8

@Dominic-Marcelino

Description

@Dominic-Marcelino

If a file should be deleted, the extension updates the data in the files.delete filter (before the action happens).
This is necessary because after deletion the filesize is not available anymore (obviously!)

Problematically the deletion can be prevented afterwards by another filter or database constraint. In this case the extension-data have been already updated in the user profile.

Steps to recreate

  • Add a collection with a relation to files, add a constraint to prevent the file deletion
  • Move over to files and try to delete the file
  • The deletion is blocked by the constraint
  • The profile was already updated falsely!

Possible solutions:

  1. Get the data in the files.delete filter but only update the userprofile in the action (after deletion)
  2. Run like this, but also store the last changes. In case the deletion does not succeed, revert them
  3. Open a PR to Directus to add the File-Object to the delete event (best solution!)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions