Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.
SOLVED

AEM 6.1 release version: Potential bug in the Commerce Product UI: fileReference containing space uses %20 and does not resolve

Avatar

Level 2

On uploading an asset to a product in the Commerce>Products UI, I selected an existing geometrixx-outdoors example asset that had a space in the name (/content/dam/geometrixx-outdoors/products/hat/Montreal%20Blue.jpg)

After uploading the asset, it does not resolve in the UI, but if I change the fileReference to /content/dam/geometrixx-outdoors/products/hat/Montreal Blue.jpg then it does resolve.

I am trying to get the asset node through the API, but finding the node with the original name (/content/dam/geometrixx-outdoors/products/hat/Montreal%20Blue.jpg) is unsuccessful so I have to replace %20 with a space and then it's ok.

Looking at the asset filereference on geometrixx products, it appears with a space rather than a %20 in the name, and resolves correctly on the product website. See the fileReference property on  /etc/commerce/products/geometrixx-outdoors/sn/snwn/snwnms/snwnms.3/image

Can you tell me why there is a %20 value in the asset name and if there are cases where we should retain the %20 value over the space. For example, as far as I can tell the fileReference should not contain the %20 value in any circumstances, but should there be other scenarios where it needs to be kept?

1 Accepted Solution

Avatar

Correct answer by
Level 10

Sounds like a bug. Please file an official support request to track this.

View solution in original post

5 Replies

Avatar

Level 9

Hi,

Actually, For JCR API, "Montreal%20Blue.jpg" & MontrealBlue.jpg are different path.

Jitendra

Avatar

Level 2

I have done some more testing around this issue.

Uploading an asset with the name 'BBEP Space_alt2.jpg' (ie: it has a space in the name between BBEP and Space) creates this path in CRX:  /content/dam/agility/bags/BBEP Space_alt2.jpg

When I select this asset in the Commerce>Products UI the fileReference changes to  /content/dam/agility/bags/BBEP%20Space_alt2.jpg, that is the space is substituted by %20 and the image does not resolve in the UI. If you have an API that is picking up the fileReference, it will not find the reference in content/dam, because yes it is a different path, but it is supposed to be the same asset.

I have managed to resolve this issue for my own API but I am raising this as a potential bug for Adobe's information. If you can tell me why the fileReference property has %20 for spaces please do, but there doesn't seem to be an obvious reason.

Avatar

Level 9

Hi,

why the fileReference property has %20 for spaces?

Well, it is very similar to what any browser does when you hit any URL with spaces. The browser just encodes it. I guess, The same thing is happening here.

For more information, here is a good post. http://stackoverflow.com/questions/497908/is-a-url-allowed-to-contain-a-space

Jitendra

Avatar

Level 2

OK, so the browser is encoding the space.

However when it does this, it creates 2 issues:

1) The image does not resolve on the product page in AEM

2) Any API trying to find the image path from the fileReference will not find it when there is a %20 in the name.

So I don't think that the fileReference should have the %20 value in the name.

Avatar

Correct answer by
Level 10

Sounds like a bug. Please file an official support request to track this.