Skip to content

Commit

Permalink
Merge pull request #166 from warrenbuckley/develop
Browse files Browse the repository at this point in the history
Fixes #149 Address Values being lowercased
  • Loading branch information
robertjf authored Feb 9, 2024
2 parents 6f7d235 + 626a56a commit e45b1f5
Showing 1 changed file with 8 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,15 @@ public override object ConvertIntermediateToObject(IPublishedElement owner, IPub
Map model = null;
if (inter != null)
{
// Handle pre v2.0.0 data.
inter = inter.ToString().ToLower().Replace("google.maps.maptypeid.", string.Empty);
bool legacyData = inter.ToString().Contains("latlng");
var jsonString = inter.ToString();

// Handle pre v2.0.0 data (Removes the prefix 'google.maps.maptypeid.')
jsonString = jsonString.Replace("google.maps.maptypeid.", string.Empty, StringComparison.InvariantCultureIgnoreCase);

bool legacyData = jsonString.Contains("latlng", StringComparison.CurrentCultureIgnoreCase);
if (legacyData)
{
var intermediate = JsonSerializer.Deserialize<LegacyMap>(inter.ToString());
var intermediate = JsonSerializer.Deserialize<LegacyMap>(jsonString);
model = new Map
{
Address = intermediate.Address,
Expand All @@ -51,7 +54,7 @@ public override object ConvertIntermediateToObject(IPublishedElement owner, IPub
}
else
{
model = JsonSerializer.Deserialize<Map>(inter.ToString());
model = JsonSerializer.Deserialize<Map>(jsonString);
}
}

Expand Down

0 comments on commit e45b1f5

Please sign in to comment.