Open juw177 opened 2 months ago
For reference.
This issue is caused by line 180 here:
The path is decoded by the LinkBuilder
. In your case the +
symbol is decoded into a space.
Later, the path is re-encoded and the space is converted into %20
(as would be proper for a space).
The addition of this pre-decoding was done here: https://github.com/adobe/aem-core-wcm-components/commit/87a8c2a1879ddd2ced81844a7afed8b59e448984
If I understand the change correctly, then the purpose was to handle situations where the link may come from author-input data and may already be encoded (i.e. a button where an author copy/pasted a link - which is reasonable for them to do). If the URL were not to be decoded, then it would end up double-encoded.
Ideally this wouldn't happen when the link is coming from a resource path (i.e. a page, asset, etc) because we know it's not already encoded.
This specific case could probably be eliminated by using a URL decoding method that adheres to RFC2396.
The java.net.URLDecoder
utility states This class contains static methods for decoding a String from the application/x-www-form-urlencoded MIME format
(see https://docs.oracle.com/javase/8/docs/api/java/net/URLDecoder.html).