5

In DXA 1.4, when image name is having few special character it is not rendering on the web page. One of the example resolved image name is Service_&_Support_tcm12-12313.jpg. In page it is rendering encoded path(en/media/Service_%26_Support_tcm12-12313.jpg) but not showing the image. When I have tried to browse the image separately with url en/media/Service_%26_Support_tcm12-12313.jpg, it is showing error message Item '/en/media/Service_&_Support_tcm12-12313.jpg' not found for Localization '12'. Can anyone suggest if fixed this issue earlier. Thanks in advance.

1
  • Two things can be done.Either don't use special characters in the name of image or do explicit encoding for special char in code. I have encountered it once. For you '&' is encoded into %26 in the url. Commented Sep 29, 2016 at 8:51

2 Answers 2

6

This was a known bug in DXA1.2 but was stated on that ticket to have been fixed in 1.4.

However, there's a report regards the .Net implementation that this would be fixed in 1.5. The discussion by JordanRobinson is very interesting and may help you towards a workaround but fundamentally you'd be best advised to update the filenames.

4
  • +1 on filenames, but with the large collection of media if you are migrating it then its gonna be a challenge for sure. Commented Sep 29, 2016 at 11:45
  • 1
    The first issue mentioned was on DXA Java and that one was indeed fixed in DXA 1.4. Ironically, a similar issue got introduced in DXA.NET 1.3 on Web 8. More specifically, the issue was in CIL 8.1 (used by DXA 1.3 and 1.4). The issue got fixed in CIL 8.2 (used by DXA 1.5). Commented Sep 29, 2016 at 17:42
  • Hey Rick, thanks for your comment here. Is there any workaround which I can do(may be temporarily) in my application code? May I use CIL 8.2 without upgrading the whole project to DXA 1.5? This is just to avoid any issue because of last minute upgrade of DXA version. Does that make sense? Commented Sep 30, 2016 at 15:54
  • 2
    Yes, it should be possible to use DXA 1.4 with CIL 8.2. You will need some (additional) assembly binding redirects in your web.config. To make it work. Note that upgrade from DXA 1.4 to 1.5 should also be quite easy. Commented Oct 5, 2016 at 6:52
4

The Query sent to the Broker to get the image will not return anything to your Model as the url sent for the request is wrong, hence you will not have it stored in your BinaryData/en/media/ as well, which leads to stop you not to use correct src url as well because there is no such image exists, moreover if any time there is no media returned from Broker, DXA would clean your BinaryData/media folder.

In my sugestion, Go with DXA1.5 where this is fixed with CLI 8.2 and if this is really not a good time to do that then please try to use Rick advice on this as also mentioned by Dylan above.

Note: if you know the media url and just want to decode it in your view, you would still not be able to get any image from Binary Data as Broker has not sent it there and Keeping them yourself is really bad idea.

1
  • Thanks Mark & Vikas for your responses. Indeed, shared urls are useful. I have tried, decoding url at application level. But it was not working. I am wondering if there is a quick fix possible at application level, without changing DXA codebase or migrating to a newer version. We have lots of images having special characters in the name. Commented Sep 29, 2016 at 13:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.