Fix bug with https blueprint provider (#79)

* Fix bug with https blueprint provider
* System.IO.Path methods would encode `/` characters
* Also re-order to try shorter paths first, to reduce
the number of NotFound responses
* Need dot in extension
This commit is contained in:
Louis DeJardin 2018-10-16 14:44:21 -07:00 коммит произвёл GitHub
Родитель c7e218e6e4
Коммит 750a91e542
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 11 добавлений и 11 удалений

1
azure-rest-api-specs Submodule

@ -0,0 +1 @@
Subproject commit baa81416330fbb712ad9f39d2e997ba8afbbb13b

Просмотреть файл

@ -38,25 +38,24 @@ namespace Microsoft.Atlas.CommandLine.Templates.FileSystems
private IEnumerable<string> WithoutPartialsFolder(string filePath)
{
yield return filePath;
const string partials = "partials/";
if (filePath.StartsWith(partials, StringComparison.Ordinal))
const string PartialsFolder = "partials/";
if (filePath.StartsWith(PartialsFolder, StringComparison.Ordinal))
{
yield return filePath.Substring(partials.Length);
yield return filePath.Substring(PartialsFolder.Length);
}
yield return filePath;
}
private IEnumerable<string> WithoutExtension(string filePath)
{
yield return filePath;
if (Path.GetExtension(filePath) == ".hbs")
const string HbsExtension = ".hbs";
if (filePath.EndsWith(HbsExtension))
{
yield return Path.Combine(
Path.GetDirectoryName(filePath),
Path.GetFileNameWithoutExtension(filePath));
yield return filePath.Substring(0, filePath.Length - HbsExtension.Length);
}
yield return filePath;
}
}
}