-
Notifications
You must be signed in to change notification settings - Fork 587
If git username is an email address, credential manager fails #587
Comments
@simonech thanks - again! I think this is a fix I can get done rather quickly. Race? 😄 |
I'm not going to win any coding races. Ran outta time tonight. If there's no pull-request tomorrow I'll look into it. Thanks again! |
This indeed is an easy fix, but wanted to check why it got broken between 1.14 and now and if possible do it the same way it was done before.
…Sent from my iPhone
On 16 Mar 2018, at 06:43, J Wyman ***@***.***> wrote:
I'm not going to win any coding races. Ran outta time tonight. If there's no pull-request tomorrow I'll look into it. Thanks again!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
This bug was introduced in commit cli-shared: Remove the concept to of actual vs query URI values.. Before username was escaped with I'll submit a PR this afternoon. |
@simonech the |
The easy fix for the @ sign is just replacing @ in username with %40.
Don't know it there are other characters that need to be escaped
…On Fri, Mar 16, 2018 at 1:51 PM, J Wyman ***@***.***> wrote:
@simonech <https://github.com/simonech> the Uri.EscapeDataString was
causing double encoding issues - we likely ought to find a separate
solution. Thanks!
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#587 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AADwdTHw_sivNe94A7vHDiDfgbt7xay5ks5te7VLgaJpZM4SscwD>
.
--
Simone Chiaretta
Microsoft MVP ASP.NET - ASPInsider
Blog: http://codeclimber.net.nz
RSS: http://feeds2.feedburner.com/codeclimber
twitter: @simonech
|
According to RFC3986, reserved characters in URIs are |
Perhaps something like internal virtual void CreateTargetUri()
{
string queryUrl = null;
string proxyUrl = _proxyUri?.OriginalString;
StringBuilder buffer = new StringBuilder();
// URI format is {protocol}://{username}@{host}/{path] with
// everything optional except for {host}.
// Protocol.
if (!string.IsNullOrWhiteSpace(_queryProtocol))
{
buffer.Append(_queryProtocol)
.Append("://");
}
// Username.
if (!string.IsNullOrWhiteSpace(_username))
{
// !!! --- FIX BEGINS HERE ---
var username = NeedsToBeEscaped(_username)
? Uri.EscapeDataString(_username)
: _username;
buffer.Append(username)
.Append('@');
// --- END OF FIX !!!
}
// Host.
buffer.Append(_queryHost)
.Append('/');
// Path
if (!string.IsNullOrWhiteSpace(_queryPath))
{
buffer.Append(_queryPath);
}
queryUrl = buffer.ToString();
// Create the target URI object.
_targetUri = new TargetUri(queryUrl, proxyUrl);
}
private static bool NeedsToBeEscaped(string value)
{
for (int i = 0; i < value.Length; i += 1)
{
switch (value[i])
{
case ':':
case '/':
case '?':
case '#':
case '[':
case ']':
case '@':
case '!':
case '$':
case '&':
case '\'':
case '(':
case ')':
case '*':
case '+':
case ',':
case ';':
case '=':
return true;
}
}
return false;
} would be the right answer? |
Extend solution for microsoft#587 to also handle: username=DOMAIN\username
Extend solution for microsoft#587 to also handle: username=DOMAIN\username
Extend solution for microsoft#587 to also handle: username=DOMAIN\username
If the git username is an email address like
name.surname@example.com
the credential manager fails with the error:The problem is that the target of format
{protocol}://{username}@{host}/{path]
then becomeshttps://name.surname@example.com@mygiteserver.com
and then theUri
validation fails.I'm debugging it and will send a PR as soon as I solve the problem.
There is no problem when using the standard credential manager that comes with git for windows
The text was updated successfully, but these errors were encountered: