November Happy Hour will be moved to Thursday December 5th.

Remove Unrelated Content Assets job deletes content in use

A.D
A.D
Vote:
 

This is probably a real edge case, but worth noting given content can be lost from a website. Might be worthwhile someone else trying to reproduce.

While troubleshooting failure of the 'Remove Unrelated Content Assets' job, I found a situation where content displayed on a site will be deleted by the job. Steps to reproduce in Alloytec aren't exactly straightforward, but this issue could be bigger for some sites that have used the Url property for images more extensively. I.e., from Alloytec:

  public class SiteLogotypeBlock : SiteBlockData
    {
        /// <summary>
        /// Gets the site logotype URL
        /// </summary>
        /// <remarks>If not specified a default logotype will be used</remarks>
        [DefaultDragAndDropTarget]
        [UIHint(UIHint.Image)]
        public virtual Url Url
...

}

Steps to reproduce (using Alloytec on Optimizely/Epi v11.15):

  1. Create a new 'Standard Page' under the Start page, let's call it 'Page 1'. Publish it.
  2. While editing the new page, go to the Assets Pane, click on 'For this Page' > Media and upload an image called something like 'new-logo.png'. The idea is to upload an image into the 'Content Asset Folder' that is owned by 'Page 1'
  3. Under the Root page, create a new 'Start' page, let's call it 'New Alloytec home page'
  4. Click on the Site Settings tab
  5. Click on Logotype > Url to choose an image for the site logo
  6. In the 'Select Image' dialog, search for 'new-logo'. The logo uploaded to Page 1 will appear. Select it and publish the page
  7. Go to Admin > Config tab > Manage websites
  8. Click on the Alloytec site name
  9. In the General section, change the Start page to the 'New Alloytec home page' created in step 3
  10. Save the changes and open the new home page. You should see a page with the new logo in the top left
  11. Go back to Edit mode and delete the standard page 'Page 1' created in step 1 (Move to Trash)
  12. View Trash and permanently delete 'Page 1'
  13. Go to Admin > Admin tab > Scheduled jobs > Remove Unrelated Content Assets > Start Manually
  14. Click on the History tab - it should state that 1 unused content asset folders have been deleted
  15. Go back to the new home page and refresh.
  16. The new logo should have vanished from the new site

So, not sure if this issue will impact many, but might be good to prevent images etc from showing in the 'Select image' dialog when they're stored in a Content Asset Folder for another page, so these cross-references can't be created in the first place.

In other words, the Select image search should only show images stored in Global assets, Site assets or the Content Asset folder owned by the content being edited.

I also wonder if the scheduled job can be updated to take these types of references into account?

Thanks

#272807
Feb 23, 2022 0:20
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.