Friday 30 June 2017

GetItem method returns null when Item Name is like GUID

Recently, we upgraded our CMS to Sitecore XP 8.2 Initial Release, we started facing weird issue. The fonts where not loading on pages. When we started digging the issue, we found a pattern. The issue was not for all font files but only for those having GUID like names

E.g. 054c9659-429a-4553-b54e-7db2eedb542a.woff2

So, we tried to reproduce and debug the same in local and we came to know that while trying to get item by using GetItem(string path) method, it returns null.

Then we tried to replicate the same in clean sitecore installation. We created an Item under /sitecore/content/Home/ and named it 054c9659-429a-4553-b54e-7db2eedb542a
Then tried to access it by using GetItem(string path) and GetItem(ID itemid) sitecore API methods,

//returns null
Item itemByPath = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("/sitecore/content/Home/054c9659-429a-4553-b54e-7db2eedb542a");

//returns item
Item itemByID = Sitecore.Configuration.Factory.GetDatabase("master").GetItem("{B0BCF717-565C-4D61-9070-0B9BCB819AA7}");

So, finally we had enough evidences to report this issue to Sitecore. Thanks to sitecore support guy Paul Kravchenko for providing hotfix for this. You can download hotfix following given link Sitecore.Support.132768.zip

No comments:

Post a Comment