@@ -25,7 +25,7 @@ internal class Property : PublishedPropertyBase
2525 // the invariant-neutral source and inter values
2626 private readonly object ? _sourceValue ;
2727 private readonly ContentVariation _variations ;
28- private bool _sourceValueIsInvariant ;
28+ private readonly ContentVariation _sourceVariations ;
2929
3030 // the variant and non-variant object values
3131 private CacheValues ? _cacheValues ;
@@ -88,7 +88,7 @@ public Property(
8888 // this variable is used for contextualizing the variation level when calculating property values.
8989 // it must be set to the union of variance (the combination of content type and property type variance).
9090 _variations = propertyType . Variations | content . ContentType . Variations ;
91- _sourceValueIsInvariant = propertyType . Variations is ContentVariation . Nothing ;
91+ _sourceVariations = propertyType . Variations ;
9292 }
9393
9494 // clone for previewing as draft a published content that is published and has no draft
@@ -104,7 +104,7 @@ public Property(Property origin, PublishedContent content)
104104 _isMember = origin . _isMember ;
105105 _publishedSnapshotAccessor = origin . _publishedSnapshotAccessor ;
106106 _variations = origin . _variations ;
107- _sourceValueIsInvariant = origin . _sourceValueIsInvariant ;
107+ _sourceVariations = origin . _sourceVariations ;
108108 }
109109
110110 // used to cache the CacheValues of this property
@@ -148,9 +148,14 @@ public override bool HasValue(string? culture = null, string? segment = null)
148148
149149 public override object ? GetSourceValue ( string ? culture = null , string ? segment = null )
150150 {
151- _content . VariationContextAccessor . ContextualizeVariation ( _variations , _content . Id , ref culture , ref segment ) ;
151+ _content . VariationContextAccessor . ContextualizeVariation ( _sourceVariations , _content . Id , ref culture , ref segment ) ;
152+
153+ // source values are tightly bound to the property/schema culture and segment configurations, so we need to
154+ // sanitize the contextualized culture/segment states before using them to access the source values.
155+ culture = _sourceVariations . VariesByCulture ( ) ? culture : string . Empty ;
156+ segment = _sourceVariations . VariesBySegment ( ) ? segment : string . Empty ;
152157
153- if ( _sourceValueIsInvariant || ( culture == string . Empty && segment == string . Empty ) )
158+ if ( culture == string . Empty && segment == string . Empty )
154159 {
155160 return _sourceValue ;
156161 }
0 commit comments