Skip to content

Commit 93d2853

Browse files
committed
Bug Fix
1 parent 361dcc2 commit 93d2853

File tree

4 files changed

+21
-19
lines changed

4 files changed

+21
-19
lines changed

.vs/ScriptBloxAPI/v17/.suo

51 KB
Binary file not shown.

Methods/Scripts.cs

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
using System.Linq;
77
using ScriptBloxAPI.Backend_Functions;
88
using System.Threading.Tasks;
9+
using Newtonsoft.Json;
10+
911
// ReSharper disable UnusedMember.Global
1012
#pragma warning disable IDE0270
1113

@@ -173,14 +175,22 @@ private static IEnumerable<string> GetSlugsFromResults(JToken json)
173175
{
174176
List<string> slugs = new();
175177

176-
if (json.Type == JTokenType.String)
178+
try
179+
{
177180
json = JToken.Parse(json.ToString());
181+
182+
if (!json.HasValues) return slugs;
183+
if (json["result"] == null) return slugs;
184+
if (json["result"]["scripts"] == null) return slugs;
178185

179-
JArray scripts = (JArray)json["result"]?["scripts"];
180-
181-
if (scripts == null) return slugs;
186+
JArray scripts = JArray.Parse(json["result"]?["scripts"].ToString() ?? "[]");
182187

183-
slugs.AddRange(scripts.Select(script => script.Value<string>("slug")));
188+
slugs.AddRange(scripts.Select(script => script.Value<string>("slug")));
189+
}
190+
catch (Exception ex)
191+
{
192+
throw new ScriptBloxException($@"An error occurred in 'GetSlugsFromResults' please create an issue @ github: {ex}{"\n"}{ex.StackTrace}");
193+
}
184194

185195
return slugs;
186196
}
@@ -207,9 +217,9 @@ private static ScriptObject CreateScriptFromData(JToken scriptData)
207217
scriptData.Value<bool>("verified"),
208218
new List<string>());
209219
}
210-
#endregion
220+
#endregion
211221

212-
#endregion
222+
#endregion
213223
#region Async
214224

215225
/// <summary>

Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,5 @@
3131
// You can specify all the values or you can default the Build and Revision Numbers
3232
// by using the '*' as shown below:
3333
// [assembly: AssemblyVersion("1.0.*")]
34-
[assembly: AssemblyVersion("5.0.0.0")]
35-
[assembly: AssemblyFileVersion("5.0.0.0")]
34+
[assembly: AssemblyVersion("5.0.1.0")]
35+
[assembly: AssemblyFileVersion("5.0.1.0")]

ScriptBloxAPI.nuspec

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,8 @@
1212
<projectUrl>https://api.irisapp.ca/Docs/ScriptBloxAPI/</projectUrl>
1313
<description>$description$</description>
1414
<releaseNotes>
15-
- 5.0.0
16-
* Added an internal convert to WebP Method, 'ConvertWebPToBitmapInternal'
17-
* Changed internl C# Language to 'latest'
18-
* Updated 'NetCore.Platforms' -> 7.0.4
19-
* Updated 'Fody' -> 6.8.0
20-
* Fixed bug with 'GetSlugsFromResults' throwing a 'Cannot access child value on Newtonsoft.Json.Linq.JValue.'
21-
22-
+ Added UserAgent to HttpClient to help usage control
23-
+ Created a new script Method 'GetScriptsWithFilter, GetScriptsWithFilterAsync'
24-
+ Created new Enum for Filters 'ScriptsMethod.FilterType' to be used with the new methods.
15+
- 5.0.1
16+
- Hopefully fixed Slug issue
2517
</releaseNotes>
2618
<copyright>$copyright$</copyright>
2719
<tags>ScriptBlox ScriptBloxAPI</tags>

0 commit comments

Comments
 (0)