Skip to content

Commit 2047ccd

Browse files
committed
Update building array string and encoding in GetConfigContentAPIUrl
1 parent 5999cd7 commit 2047ccd

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

Runtime/Scripts/Core/Utilities/JoystickUtilities.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using System;
12
using System.Text;
23
using JoystickRemoteConfig.Core.Data;
34
using UnityEngine;
@@ -27,8 +28,9 @@ public static string GetConfigContentAPIUrl(string[] contentIds)
2728

2829
for (int i = 0; i < contentIds.Length; i++)
2930
{
31+
// Ensure each content ID is properly encoded
3032
stringBuilder.Append("\"");
31-
stringBuilder.Append(contentIds[i]);
33+
stringBuilder.Append(Uri.EscapeDataString(contentIds[i]));
3234
stringBuilder.Append("\"");
3335

3436
if (i < contentIds.Length - 1)
@@ -43,7 +45,10 @@ public static string GetConfigContentAPIUrl(string[] contentIds)
4345
string responseTypeParam = "&responseType=serialized";
4446
string appendParam = shouldSerialized ? responseTypeParam : string.Empty;
4547

46-
return $"https://api.getjoystick.com/api/v1/combine/?c=[{stringBuilder}]&dynamic=true{appendParam}";
48+
// Properly encode the entire 'c=[...]' query parameter
49+
string encodedCParameter = Uri.EscapeDataString($"[{stringBuilder}]");
50+
51+
return $"https://api.getjoystick.com/api/v1/combine/?c={encodedCParameter}&dynamic=true{appendParam}";
4752
}
4853

4954
public static string GetCatalogAPIUrl()

0 commit comments

Comments
 (0)