commit 15c3f52d7f10144a379babe784d7517204e38a13
parent 538bd91600ee21dd0f4b52cfd744d03160ec3865
Author: Michael Rasmussen <mir@datanom.net>
Date: Mon, 17 Oct 2022 23:27:55 +0200
Handle non-ascii characters in server response. Fixes bug #4636
Signed-off-by: Michael Rasmussen <mir@datanom.net>
Diffstat:
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/oauth2.c b/src/oauth2.c
@@ -147,7 +147,7 @@ static gint oauth2_filter_access (gchar *json, gchar *access_token, gint *expiry
GMatchInfo *matchInfo;
GRegex *regex;
- regex = g_regex_new ("\"access_token\": ?\"(.*?)\",?", 0, 0, NULL);
+ regex = g_regex_new ("\"access_token\": ?\"(.*?)\",?", G_REGEX_RAW, 0, NULL);
g_regex_match (regex, json, 0, &matchInfo);
if (g_match_info_matches (matchInfo))
g_stpcpy (access_token,g_match_info_fetch (matchInfo, 1));
@@ -158,7 +158,7 @@ static gint oauth2_filter_access (gchar *json, gchar *access_token, gint *expiry
g_match_info_free (matchInfo);
- regex = g_regex_new ("\"expires_in\": ?([0-9]*),?", 0, 0, NULL);
+ regex = g_regex_new ("\"expires_in\": ?([0-9]*),?", G_REGEX_RAW, 0, NULL);
g_regex_match (regex, json, 0, &matchInfo);
if (g_match_info_matches (matchInfo)){
// Reduce available token life to avoid attempting connections with (near) expired tokens
@@ -178,7 +178,7 @@ static gint oauth2_filter_refresh (gchar *json, gchar *refresh_token)
GMatchInfo *matchInfo;
GRegex *regex;
- regex = g_regex_new ("\"refresh_token\": ?\"(.*?)\",?", 0, 0, NULL);
+ regex = g_regex_new ("\"refresh_token\": ?\"(.*?)\",?", G_REGEX_RAW, 0, NULL);
g_regex_match (regex, json, 0, &matchInfo);
if (g_match_info_matches (matchInfo))
g_stpcpy (refresh_token,g_match_info_fetch (matchInfo, 1));