From aa15b54634b3b113003e4daf536868331a592fd4 Mon Sep 17 00:00:00 2001 From: JohnMcPMS Date: Wed, 27 Sep 2023 08:21:45 -0700 Subject: [PATCH] Improve header retrieval and logging (#3680) (#3686) --- src/AppInstallerCommonCore/Downloader.cpp | 2 +- .../Microsoft/PreIndexedPackageSourceFactory.cpp | 13 ++++++++++++- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/AppInstallerCommonCore/Downloader.cpp b/src/AppInstallerCommonCore/Downloader.cpp index d69ee1d28e..dfff527c8a 100644 --- a/src/AppInstallerCommonCore/Downloader.cpp +++ b/src/AppInstallerCommonCore/Downloader.cpp @@ -168,7 +168,7 @@ namespace AppInstaller::Utility for (const auto& header : response.Headers()) { - result.emplace(Utility::ConvertToUTF8(header.Key()), Utility::ConvertToUTF8(header.Value())); + result.emplace(Utility::FoldCase(static_cast(Utility::ConvertToUTF8(header.Key()))), Utility::ConvertToUTF8(header.Value())); } return result; diff --git a/src/AppInstallerRepositoryCore/Microsoft/PreIndexedPackageSourceFactory.cpp b/src/AppInstallerRepositoryCore/Microsoft/PreIndexedPackageSourceFactory.cpp index 56af8f95fa..fc863abd8d 100644 --- a/src/AppInstallerRepositoryCore/Microsoft/PreIndexedPackageSourceFactory.cpp +++ b/src/AppInstallerRepositoryCore/Microsoft/PreIndexedPackageSourceFactory.cpp @@ -161,11 +161,22 @@ namespace AppInstaller::Repository::Microsoft AICLI_LOG(Repo, Verbose, << "Header indicates version is: " << itr->second); return { itr->second }; } + + // We did not find the header we were looking for, log the ones we did find + AICLI_LOG(Repo, Verbose, << "Did not find " << s_PreIndexedPackageSourceFactory_PackageVersionHeader << " in:\n" << [&]() + { + std::ostringstream headerLog; + for (const auto& header : headers) + { + headerLog << " " << header.first << " : " << header.second << '\n'; + } + return std::move(headerLog).str(); + }()); } CATCH_LOG(); } - AICLI_LOG(Repo, Verbose, << "No version header, falling back to reading the package data"); + AICLI_LOG(Repo, Verbose, << "Falling back to reading the package data"); Msix::MsixInfo info{ packageLocation }; auto manifest = info.GetAppPackageManifests();