enonic / app-contentstudio

Content Studio of Enonic XP
GNU General Public License v3.0
10 stars 4 forks source link

Attachment is removed from content while it's still in use #2962

Closed alansemenov closed 3 years ago

alansemenov commented 3 years ago
  1. Create a part descriptor with AttachmentUploader
  2. Add two parts to a page and select this descriptor for both of them
  3. Upload the same attachment into both parts

image

  1. Now delete the attachment from one of the parts.

Bug: The attachment is deleted from the content even though it's still in use in the other part.

image

Part XML:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<part xmlns="urn:enonic:xp:model:1.0">
  <display-name>Attachment in part</display-name>
  <form>
    <input name="attachment" type="AttachmentUploader">
      <label>Single Attachment (required)</label>
      <occurrences minimum="1" maximum="1"/>
    </input>
  </form>
</part>
ashklianko commented 3 years ago

Same problem for attachments in content types

ashklianko commented 3 years ago

One more case when you have both content type with attachment and part with attachment: uploading same item for both leads to a single attachment that will be removed for both content type and part no matter if remove was triggered on part or content type form input