AEM 6.1 release version: Potential bug in the Commerce Product UI: fileReference containing space uses %20 and does not resolve | Community
Skip to main content
Level 2
January 15, 2016
Solved

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

  • January 15, 2016
  • 5 replies
  • 1224 views

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?

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.
Best answer by Sham_HC

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

5 replies

Jitendra_S_Toma
Level 10
January 15, 2016

Hi,

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

Jitendra

Level 2
January 15, 2016

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.

Jitendra_S_Toma
Level 10
January 15, 2016

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

Level 2
January 15, 2016

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.

Sham_HC
Sham_HCAccepted solution
Level 10
January 15, 2016

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