From f8466abdb2756bba48596773e37d1fc2b6a9b630 Mon Sep 17 00:00:00 2001 From: John McPherson Date: Wed, 8 May 2024 15:45:05 -0700 Subject: [PATCH] replace backslashes as Kestrel may not like them --- src/AppInstallerCommonCore/FileCache.cpp | 5 ++++- src/AppInstallerCommonCore/Public/winget/FileCache.h | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/AppInstallerCommonCore/FileCache.cpp b/src/AppInstallerCommonCore/FileCache.cpp index 4038baa3ab..1594445d44 100644 --- a/src/AppInstallerCommonCore/FileCache.cpp +++ b/src/AppInstallerCommonCore/FileCache.cpp @@ -210,8 +210,11 @@ namespace AppInstaller::Caching return result; } - std::unique_ptr FileCache::GetUpstreamFile(const std::string& relativePath, const Utility::SHA256::HashBuffer& expectedHash) const + std::unique_ptr FileCache::GetUpstreamFile(std::string relativePath, const Utility::SHA256::HashBuffer& expectedHash) const { + // Replace backslashes with forward slashes for HTTP requests (since local can handle them). + Utility::FindAndReplace(relativePath, "\\", "/"); + std::exception_ptr firstException; for (const auto& upstream : m_sources) diff --git a/src/AppInstallerCommonCore/Public/winget/FileCache.h b/src/AppInstallerCommonCore/Public/winget/FileCache.h index 1bea547d56..59d1826f3b 100644 --- a/src/AppInstallerCommonCore/Public/winget/FileCache.h +++ b/src/AppInstallerCommonCore/Public/winget/FileCache.h @@ -53,7 +53,7 @@ namespace AppInstaller::Caching private: // Gets a stream containing the contents of the requested file from an upstream source. // The hash must match for this function to return successfully. - std::unique_ptr GetUpstreamFile(const std::string& relativePath, const Utility::SHA256::HashBuffer& expectedHash) const; + std::unique_ptr GetUpstreamFile(std::string relativePath, const Utility::SHA256::HashBuffer& expectedHash) const; Details m_details; std::vector m_sources;