Fix json parsing with invalid chars like \u0000 preventing some channels from loading

This commit is contained in:
Brahim Hadriche committed 2025-11-14 15:47:49 -05:00
1 parent 9a319eab75
commit b5261d900f
27 files changed
+61 -32

No files matched your search

@@ -66,7 +66,7 @@ namespace Http
return true
end if
feedSource = ParseJson(feedSource)
feedSource = StringUtils.ParseJsonSafe(feedSource)
if feedSource = invalid
response.Default(400, "Expected valid JSON for feed-source")
return true
@@ -804,7 +804,7 @@ namespace Http
' (such as "newest", "oldest", etc.), we'll ignore it, as it is not supported.
sortBy = request.query.sort_by
if not StringUtils.IsNullOrEmpty(sortBy) and sortBy.StartsWith("{")
sortBy = ParseJson(sortBy)
sortBy = StringUtils.ParseJsonSafe(sortBy)
if IsAssociativeArray(sortBy)
if sortBy.DoesExist("params")
options.params = sortBy.params
@@ -19,7 +19,7 @@ namespace Http
saved = RegistryUtils.Read(RegistryUtils.PLAYLET_LIB_URLS)
if saved <> invalid
saved = ParseJson(saved)
saved = StringUtils.ParseJsonSafe(saved)
end if
response.Json({
@@ -272,7 +272,7 @@ namespace Http
return invalid
end if
m.body_json = ParseJson(text)
m.body_json = StringUtils.ParseJsonSafe(text)
return m.body_json
end function
end class
@@ -11,7 +11,7 @@ namespace Http
if StringUtils.IsNullOrEmpty(json)
return "application/octet-stream"
end if
map = ParseJson(json)
map = StringUtils.ParseJsonSafe(json)
if not IsAssociativeArray(map)
return "application/octet-stream"
end if
@@ -41,7 +41,7 @@ namespace Http
if StringUtils.IsNullOrEmpty(json)
return ""
end if
map = ParseJson(json)
map = StringUtils.ParseJsonSafe(json)
if not IsAssociativeArray(map)
return ""
end if