Merge branch 'master' into fix-issue-3611

This commit is contained in:
abraunegg 2026-01-28 21:21:19 +11:00 committed by GitHub
commit 298e64d125
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -795,13 +795,15 @@ class OneDriveApi {
}
// match the authorisation code
auto c = matchFirst(response, r"(?:[\?&]code=)([\w\d-.]+)");
auto c = matchFirst(strip(response), r"(?:[?&]code=)([^&]+)");
if (c.empty) {
addLogEntry("An empty or invalid response uri was entered");
return false;
}
c.popFront(); // skip the whole match
redeemToken(c.front);
string authCode = decodeComponent(c.front);
redeemToken(authCode);
return true;
}
}
@ -1252,13 +1254,13 @@ class OneDriveApi {
(*headers)["Prefer"] = "Include-Feature=AddToOneDrive";
}
private void redeemToken(char[] authCode) {
char[] postData =
private void redeemToken(string authCode) {
string postData =
"client_id=" ~ clientId ~
"&redirect_uri=" ~ redirectUrl ~
"&code=" ~ authCode ~
"&redirect_uri=" ~ encodeComponent(redirectUrl) ~
"&code=" ~ encodeComponent(authCode) ~
"&grant_type=authorization_code";
acquireToken(postData);
acquireToken(postData.dup);
}
private void acquireToken(char[] postData) {