Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

On image upload the download link is absolute and relative on the same image selected using the Object Browser #6160

Open
ichim-david opened this issue Jul 10, 2024 · 3 comments

Comments

@ichim-david
Copy link
Sponsor Member

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

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

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.

@davisagli
Copy link
Sponsor Member

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.

@ichim-david
Copy link
Sponsor Member Author

@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

@davisagli
Copy link
Sponsor Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants