Do not canonicalize short paths (#736)

This commit is contained in:
Pavel Krymets 2018-03-28 14:24:42 -07:00 committed by GitHub
parent c88d37f04d
commit c06de96bd3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 17 additions and 3 deletions

View File

@ -61,13 +61,17 @@ Return Values:
return hr;
}
}
else
else if (wcslen(pszName) > MAX_PATH)
{
if (FAILED(hr = pstrPath->Copy(L"\\\\?\\")))
{
return hr;
}
}
else
{
pstrPath->Reset();
}
return pstrPath->Append(pszName);
}

View File

@ -71,7 +71,7 @@ namespace AspNetCoreModuleTests
Assert::AreEqual(DWORD(3), retVal);
Assert::AreEqual(exeStr, bstrArray[0]);
Assert::AreEqual(L"exec", bstrArray[1]);
Assert::AreEqual(L"\\\\?\\C:\\test\\test.dll", bstrArray[2]);
Assert::AreEqual(L"C:\\test\\test.dll", bstrArray[2]);
}
TEST_METHOD(ParseHostfxrArguments_ProvideNoArgs_InvalidArgs)

View File

@ -28,8 +28,13 @@ namespace Microsoft.AspNetCore.Server.IISIntegration.FunctionalTests
[ConditionalFact]
public async Task ReturnsNullForUndefinedServerVariable()
{
var port = _fixture.Client.BaseAddress.Port;
Assert.Equal("THIS_VAR_IS_UNDEFINED: (null)", await _fixture.Client.GetStringAsync("/ServerVariable?q=THIS_VAR_IS_UNDEFINED"));
}
[ConditionalFact]
public async Task BasePathIsNotPrefixedBySlashSlashQuestionMark()
{
Assert.DoesNotContain(@"\\?\", await _fixture.Client.GetStringAsync("/BasePath"));
}
}
}

View File

@ -667,5 +667,10 @@ namespace IISTestSite
}
});
}
private void BasePath(IApplicationBuilder app)
{
app.Run(async ctx => { await ctx.Response.WriteAsync(AppDomain.CurrentDomain.BaseDirectory); });
}
}
}