Skip to content

Commit

Permalink
Modifying to extension method UrlEncodeForGoogle
Browse files Browse the repository at this point in the history
  • Loading branch information
Edrisym committed Nov 5, 2024
1 parent 5e52b4f commit ac68283
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Common/Method.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace GoogleCalendarApi.Common;

public class Method
public static class Method
{
public static string UrlEncodeForGoogle(string url)
public static string UrlEncodeForGoogle(this string url)
{
var unreservedChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-.~";
var result = new StringBuilder();
Expand Down
6 changes: 4 additions & 2 deletions Services/GoogleCalendarService.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
namespace GoogleCalendarApi.Services;
using GoogleCalendarApi.Common;

namespace GoogleCalendarApi.Services;

public class GoogleCalendarService : IGoogleCalendarService
{
Expand Down Expand Up @@ -174,7 +176,7 @@ public string GetAuthCode()
var include_granted_scopes = "true";
// var prompt = "select_account";
var login_hint = _settings.Value.LoginHint;
string redirect_uri_encode = Method.UrlEncodeForGoogle(redirectURL);
string redirect_uri_encode = redirectURL.UrlEncodeForGoogle();
return string.Format(scopeURL1, redirect_uri_encode, state, response_type, client_id, scope,
access_type, include_granted_scopes, login_hint);
}
Expand Down

0 comments on commit ac68283

Please sign in to comment.