Kunena / Kunena-Forum

Kunena Forum - Forum / Bulletin Board / Discussions component for Joomla - This is the 6.x/5.x main development branch. Please do not open issues regarding earlier versions of Kunena
https://www.kunena.org
GNU General Public License v3.0
1.75k stars 812 forks source link

Cancel button does not remove database entries from attachments #9730

Open rich20 opened 4 weeks ago

rich20 commented 4 weeks ago

Describe the bug https://www.kunena.org/forum/k-6-3-0-support/168554-strange-error Confirmed

To Reproduce

  1. Create post
  2. Upload Picture
  3. Press Insert in message
  4. Cancel post
  5. Go to Attachment Manage and try delete this attachment

Actual result Cannot save topic: Category 0 doesn't exist!

Additional context The reason is that it does not remove the database entry with the cancel button as it used to. This results in an orphaned database entry.

System information

Desktop

Gindi50 commented 4 weeks ago

Joomla 5.1.4, Kunena 6.3.4 Database: 10.6.15-MariaDB

I have just tried to reproduce the error from #9730.

  1. created a new topic.

  2. uploaded a picture.

  3. inserted into the topic with ‘Insert’.

  4. cancelled the topic with ‘Cancel’.

  5. deleted the inserted image in the profile under attachment management.

Current result: Error message ’

danger

The topic cannot be saved: Category 0 does not exist! ’

But in the profile in the attachment management the image is deleted.

In the database, the image only exists once in jom5_kunena_attachments.

rich20 commented 4 weeks ago

@Gindi50 Does it also add an orphaned attachment entry in the diagnostics?

Gindi50 commented 4 weeks ago

Yes, one problem was displayed with attachmentOrphaned.

Gindi50 commented 3 weeks ago

I have tested again with three pictures.

After selecting and before inserting the images, the images are already in profile/attachment management and in the database at jom5_kunena_attachment.

In Kunena/Tools/Diagnosis there are now 3 problems with attachmentOrphaned.

Then I inserted the three images.

Then I removed the three images in the post and everything was gone, the text and the images. The text field said ‘true’.

In the profile/attachment management there were only two pictures left, one was deleted.

In Kunena/Tools/Diagnosis there are now 2 problems with attachmentOrphaned.

In the database at jom5_kunena_attachment there are now 2 images.

Then I cancelled the post. (With the known error message)

In the profile I could delete the two pictures (with the known error message)

The other two images were also deleted in the database.

There was also no problem in the diagnosis.

Pinkeltje commented 3 weeks ago

When using cancel button there are no entries for those images in attachment manager. Only error is that they remain in database. But it doesn't cause any error in site or administrator and when in Diagnostics attachmentOrphaned you click delete broken items, that "problem" is solved as well. So I really don't see the problem (except from the remaining entries in de database)