Problem

When you create a new modal, after adding an image into a field "body" and save the modal. After that you will go to the database and do a select query of the table named "file_managed". Look for the image previously uploaded into the modal and verify the column "status" equal zero. This value 0 in the status causes that the image disappear after time.

Steps to reproduce

  1. Go to route "/admin/structure/modal"
  2. Click button "Add modal"
  3. Upload image in Body field
  4. Click button "Save"

Issue fork modal_page-3266023

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

danielsan18 created an issue. See original summary.

danielsan18’s picture

Issue summary: View changes
renatog’s picture

Hummmm interesting!

This status = 0 means that is a temporary file right?! And for this reason it'll be deleted in sometime.

It's a real bug, you're right

danielsan18’s picture

I have created a fork and added a commit to fix the error. This commit reads the inline images from the body field and changes it's status = 1.

renatog’s picture

Your Merge Request is amazing! Thanks for your great job!

Jugestion:

I think we can move the methods "extractFilesUuid" and "recordFileUsage" to another Helper instead of keep those in "ModalForm" class. What do you think, is it makes sense?

danielsan18’s picture

Yes, it's possible. I am going to do the test and I'll send new commits.

renatog’s picture

Amazing! Thank you so much Daniel 😀👍

renatog’s picture

Status: Active » Reviewed & tested by the community

Amazing! Thank you so much for your help on that @danielsan18

It's a really good catch!

I tested and it's really working fine

  • RenatoG committed 2ceca92 on 4.1.x authored by danielsan18
    Issue #3266023 by danielsan18, RenatoG: Add image into Body field, after...
renatog’s picture

Status: Reviewed & tested by the community » Fixed

Moved to the dev branch

Thank you so much for your contribution

renatog’s picture

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.