Currently, after discarding a draft for the Image Content Object (or any Content Object that has Image Content Field) the "medium" alias for this image is also deleted (but only if this image isn't used as a relation in other Content Objects). This doesn't cause issues for most use cases since the "medium" alias can be regenerated automatically when accessed in the back-office or the front-office. However, this can cause issues if the "medium" image alias is accessed through direct URL (like http://your-site.dev/var/ezdemo_site/storage/images/media/images/test-image/343-1-eng-GB/Test-image_medium.jpg). For example, currently YOOCHOOSE stores only direct URLs to image aliases, so the issue manifests itself when trying to view the recommendations.
It is possible that not only "medium" alias is affected, but from my tests it looks like the "large" or "small" aliases are not affected.
The steps to reproduce below also happen with DFS cluster setup (https://doc.ez.no/display/EZP/Legacy+DFS+cluster). Only the end result differs a little because it results in 404 error from Symfony with the following error message:
Could not find 'BinaryFile' with identifier '/var/ezdemo_site/storage/images/media/images/test-image/343-1-eng-GB/Test-image_medium.jpg'
Since it was originally reported for DFS cluster setup, the patch should also be tested for this setup.
Also, the patch should be tested for both Image Content Type and Article Content Type (there is "Image" Content Field Type there that behaves in the same way).
I wasn't able to reproduce this issue on eZ Platform.
Steps to reproduce
- Create new eZ Publish 5.4 installation.
- In the legacy admin panel, go to "Media library"/"Media"/"Images" and create new Image Content Object there named "Test image". As an image file, upload any picture.
- Enter the edit mode for the "Test image" content object. Right click the preview image there and open it in a new browser tab. Its URL should look like this: http://your-site.dev/var/ezdemo_site/storage/images/media/images/test-image/343-1-eng-GB/Test-image_medium.jpg meaning that it is "medium" image alias for the 1st version of this Image Content Object.
- In the browser tab that is in the edit view, click "Discard draft" and confirm.
- Refresh the browser tab with the "medium" image alias. There will be 404 error with the following error message:
The requested URL /var/ezdemo_site/storage/images/media/images/test-image/343-1-eng-GB/Test-image_medium.jpg was not found on this server.