SaaS CMS has officially launched! Learn more now.

LinkItemCollection issue



While using the LinkItemCollection property I`ve encountered a weird issue.

If I try to add a new linkItem using the external url , e.g.

This will be saved in the DB as “<links><a href="~/link/33dd54ea609d4544a2f4d5cefb027277.aspx?sizes=california+king"> Link</a></links>”

If you edit that link in the cms you will see in the Remaining Url field the encoded value.

After making any update on this block where the link item collection is used, in the DB the value for the link will be updated like this : <links><a href="~/link/33dd54ea609d4544a2f4d5cefb027277.aspx?sizes=california%20kingupdate">Link</a></links>.

It will automatically encode the +  to %20 ( which is not even the correct encoding value for +).

Is this issue known ? 
Has anybody else encountered this issue before?

Jan 22, 2024 13:38

Percent encoding is correct. Please see "Escaping" spaces in the query with + is for backwards compatability.

If you actully want to escape + and not treat it as a space, then you need to escape it before saving it. You need to pass in

Jan 23, 2024 8:23

I have asked our QAs to verify this behavior and they will log a bug for it if necessary

Edited, Jan 23, 2024 9:51

@Quan Mai thank you! 
Please keep me updated.

Jan 23, 2024 9:53
Quan Mai - Jan 23, 2024 14:11
as commented by my colleague @Johan, this behavior seems to be "as designed"

I just tested this in EPiServer.CMS 12.26.0, by just suppling a 'Remaining URL', and this is the results I got:
?sizes=california king > ?sizes=california%20king
?sizes=california%20king > ?sizes=california%20king
?sizes=california+king > ?sizes=california%2Bking
?sizes=california%2Bking > ?sizes=california%2Bking

All these cases seems right to me. Since we're percent encoding internally. But there might be issues when providing an internal URL via the 'External link' field. Then we're assuming that the URL is already escaped, i.e. + will be unescpaed to space and then percent encoded as %20.

Jan 23, 2024 14:00

@Johan You are correct. "But there might be issues when providing an internal URL via the 'External link' field." This is what we are encountering. Do you have any suggestions here ?

Jan 25, 2024 14:04
* 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.