Open ichim-david opened 1 month ago
The first one comes from the full content serializer and the second one comes from the summary serializer (from the catalog). The paths have to be stored in the catalog without the hostname, but I think we should update the serializer to convert them back to full URLs which are easier to use on the frontend. The volto Image component already handles both relative and absolute URLs, so it should not be breaking.
@davisagli I think the opposite, we should use the url without the host name. We were having issues with image referencing when copying the dB from the main site to a staging and the full path meant no proper display of images. Since image blocks indeed tries to flatten to url which is relative it's easy to have the relative directly.
We were hit by another issues which I added dealing with razzle public path setting where the urls appeared with like like backend:8080 but yeah I that's another discussion
@ichim-david It's already stored without the hostname, and that should of course remain the same.
The reason I want a full URL here is to be consistent with the REST API in general, where almost everything uses a full URL for serialization. Then it's the client's job to remove the hostname (i.e. with flattenToAppUrl) when the hostname isn't wanted.
We also have sites which use the "preview image link" behavior from plone.volto, where the scale might actually come from a different content item. This is easier to handle on the client side if the serialized image scales have full URLs, so that the client doesn't need to find the right base path.
In Volto when you add an image block and you upload an image, after you inspect the data information, within the image scales you will see that the download link is set with absolute value as seen in this image:![volto-image-download-link-uploaded](https://github.com/plone/plone.restapi/assets/152852/8d9101b8-e050-4d20-bc93-ec71eb65412b)
If I add another image block and select using the Object browser the same image the download url no longer contains the absolute path as seen in this screenshot:![volto-image-download-link-selected](https://github.com/plone/plone.restapi/assets/152852/391e133d-0ca5-4063-ad56-763eeec79e15)
I would expect the same url behavior to happen when uploading as when you select the image that was already uploaded without the site path hardcode.
It should be investigated if the problem arrives from Volto and plone.restapi itself or if it is a combination of faults.