We've migrated our Sitecore solution from Sitecore 9.3 to 10.4
and GlassMapper
is used to map items on backend code (GlassMapper updated too - latest version).
On some RichText
fields we have Sitecore internal links. For the application users without permission to read the referenced item in that link, the following error is thrown and the field content/component is not displayed on front-end:
ERROR Failed to render field
Exception: Glass.Mapper.MapperException
Message: Failed to render field {FDC75776-18F5-48EC-8AD6-CAE7EF986A2F} on item {4771E685-AB76-473E-9556-6DB57A4EF37D}
Source: Glass.Mapper.Sc
at Glass.Mapper.Sc.DataMappers.SitecoreFieldStringMapper.RunPipeline(Field field, GetOptionsSc options) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\DataMappers\SitecoreFieldStringMapper.cs:line 94
at Glass.Mapper.Sc.DataMappers.SitecoreFieldStringMapper.GetField(Field field, SitecoreFieldConfiguration config, SitecoreDataMappingContext context) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\DataMappers\SitecoreFieldStringMapper.cs:line 63
at Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateInterface.InterfacePropertyInterceptor.LoadValue(AbstractPropertyConfiguration propertyConfiguration) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\ObjectConstruction\Tasks\CreateInterface\InterfacePropertyInterceptor.cs:line 115
at Glass.Mapper.Pipelines.ObjectConstruction.Tasks.CreateInterface.InterfacePropertyInterceptor.Intercept(IInvocation invocation) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper\Pipelines\ObjectConstruction\Tasks\CreateInterface\InterfacePropertyInterceptor.cs:line 85
at Castle.DynamicProxy.AbstractInvocation.Proceed()
at Castle.Proxies.IMilkConsignmentOverviewProxy.get_TableCaptionContent()
at lambda_method(Closure , MilkConsignmentOverview )
at Glass.Mapper.Sc.GlassHtml.NormalModeOutput[T](Expression`1 field, Expression`1 standardOutput, T model, SafeDictionary`1 dictionary) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\GlassHtml.cs:line 639
at Glass.Mapper.Sc.GlassHtml.MakeEditable[T](Expression`1 field, Expression`1 standardOutput, T model, Object parameters, Context context, Database database, TextWriter writer) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\GlassHtml.cs:line 603
Nested Exception
Exception: System.NullReferenceException
Message: Object reference not set to an instance of an object.
Source: Sitecore.Kernel
at Sitecore.Links.UrlBuilders.Helpers.ItemPathBuilder.GetRelativePath(Item item, SiteInfo site)
at Sitecore.Links.UrlBuilders.Helpers.ItemPathBuilder.Build(Item item, SiteInfo site)
at Sitecore.Links.UrlBuilders.ItemUrlBuilder.UpdateItemPathParts(Item item, UrlBuildModel model, ItemUrlBuilderOptions options)
at Sitecore.Links.UrlBuilders.ItemUrlBuilder.Build(Item item, ItemUrlBuilderOptions options)
at Sitecore.Links.DynamicLink.BuildItemUrl(ItemUrlBuilderOptions options)
at Sitecore.Links.ItemLinkExpander.Expand(String& text, ItemUrlBuilderOptions urlOptions)
at Sitecore.Links.LinkProvider.LinkParser.ExpandDynamicLinks(String text, ItemUrlBuilderOptions options)
at Sitecore.Links.LinkProvider.ExpandDynamicLinks(String text, Boolean resolveSites)
at Sitecore.Links.DefaultLinkManager.ExpandDynamicLinks(String text, Boolean resolveSites)
at Sitecore.Pipelines.RenderField.ExpandLinks.Process(RenderFieldArgs args)
at (Object , Object )
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Pipelines.DefaultCorePipelineManager.Run(String pipelineName, PipelineArgs args, String pipelineDomain)
at Glass.Mapper.Sc.DataMappers.SitecoreFieldStringMapper.RunPipeline(Field field, GetOptionsSc options) in D:\a\Glass.Mapper\Glass.Mapper\Source\Glass.Mapper.Sc\DataMappers\SitecoreFieldStringMapper.cs:line 84
The workaround to fix the error is setting configuration on the model attribute: Setting = SitecoreFieldSettings.RichTextRaw
Do you know what was changed maybe from the previous Sc version implementation?
Since we have many models, is there a more generic way to fix this behaviour?
Thanks for your help.