Skip to content

Commit 88f621f

Browse files
committed
Live preview Query update issue resolved
1 parent fcd340d commit 88f621f

5 files changed

Lines changed: 18 additions & 14 deletions

File tree

Contentstack.Core/Contentstack.Core.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
<PackageId>contentstack.csharp</PackageId>
66
<Authors>Contentstack</Authors>
77
<Description>.NET SDK for the Contentstack Content Delivery API.</Description>
8-
<PackageVersion>2.7.0</PackageVersion>
8+
<PackageVersion>2.7.1</PackageVersion>
99
<Owners>Contentstack</Owners>
1010
<PackageReleaseNotes>Live preview feature support added</PackageReleaseNotes>
11-
<Copyright>Copyright © 2012-2021 Contentstack. All Rights Reserved</Copyright>
11+
<Copyright>Copyright © 2012-2022 Contentstack. All Rights Reserved</Copyright>
1212
<PackOnBuild>true</PackOnBuild>
13-
<PackageTags>v2.7.0</PackageTags>
13+
<PackageTags>v2.7.1</PackageTags>
1414
<PackageProjectUrl>https://github.com/contentstack/contentstack-dotnet</PackageProjectUrl>
1515
<PackageLicenseFile>LICENSE.txt</PackageLicenseFile>
1616
<ReleaseVersion>2.7.0</ReleaseVersion>

Contentstack.Core/ContentstackClient.cs

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,14 +477,18 @@ public void SetHeader(string key, string value)
477477
/// </example>
478478
public void LivePreviewQuery(Dictionary<string, string> query)
479479
{
480-
string contentTypeUID = null;
481-
query.TryGetValue("content_type_uid", out contentTypeUID);
482-
this.LivePreviewConfig.ContentTypeUID = contentTypeUID;
483-
484-
string hash = null;
485-
query.TryGetValue("live_preview", out hash);
486-
this.LivePreviewConfig.LivePreview = hash;
487-
480+
if (query.Keys.Contains("content_type_uid"))
481+
{
482+
string contentTypeUID = null;
483+
query.TryGetValue("content_type_uid", out contentTypeUID);
484+
this.LivePreviewConfig.ContentTypeUID = contentTypeUID;
485+
}
486+
if (query.Keys.Contains("live_preview"))
487+
{
488+
string hash = null;
489+
query.TryGetValue("live_preview", out hash);
490+
this.LivePreviewConfig.LivePreview = hash;
491+
}
488492
}
489493

490494
/// <summary>

Contentstack.Core/LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2012-2021 Contentstack (http://app.contentstack.com). All Rights Reserved
3+
Copyright (c) 2012-2022 Contentstack (http://app.contentstack.com). All Rights Reserved
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

Contentstack.Core/Models/Entry.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1294,7 +1294,7 @@ public async Task<T> Fetch<T>()
12941294
}
12951295

12961296
HttpRequestHandler RequestHandler = new HttpRequestHandler();
1297-
var outputResult = await RequestHandler.ProcessRequest(_Url, headers, mainJson, Branch: this.ContentTypeInstance.StackInstance.Config.Branch, config: this.ContentTypeInstance.StackInstance.LivePreviewConfig);
1297+
var outputResult = await RequestHandler.ProcessRequest(_Url, headerAll, mainJson, Branch: this.ContentTypeInstance.StackInstance.Config.Branch, config: this.ContentTypeInstance.StackInstance.LivePreviewConfig);
12981298
JObject obj = JObject.Parse(ContentstackConvert.ToString(outputResult, "{}"));
12991299
var serializedObject = obj.SelectToken("$.entry").ToObject<T>(this.ContentTypeInstance.StackInstance.Serializer);
13001300
if (serializedObject.GetType() == typeof(Entry))

Contentstack.Core/Models/Query.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1693,7 +1693,7 @@ private async Task<JObject> Exec()
16931693
try
16941694
{
16951695
HttpRequestHandler requestHandler = new HttpRequestHandler();
1696-
var outputResult = await requestHandler.ProcessRequest(_Url, headers, mainJson, Branch: this.ContentTypeInstance.StackInstance.Config.Branch, config: this.ContentTypeInstance.StackInstance.LivePreviewConfig);
1696+
var outputResult = await requestHandler.ProcessRequest(_Url, headerAll, mainJson, Branch: this.ContentTypeInstance.StackInstance.Config.Branch, config: this.ContentTypeInstance.StackInstance.LivePreviewConfig);
16971697
return JObject.Parse(ContentstackConvert.ToString(outputResult, "{}"));
16981698
}
16991699
catch (Exception ex)

0 commit comments

Comments
 (0)