Skip to content

Commit 872a3e9

Browse files
committed
Fix GitHub Actions Cache setting an incorrect Content-Range header
Content-Range is 0 indexed, although nobody seemed to have encountered any issues as a result of this on github.com, but on GitHub Enterprise server it resulted in a InvalidChunkException error
1 parent e70b618 commit 872a3e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/vcpkg/binarycaching.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -923,15 +923,15 @@ namespace
923923

924924
size_t upload_count = 0;
925925
auto cache_size = m_fs.file_size(zip_path, VCPKG_LINE_INFO);
926+
if (cache_size == 0) return upload_count;
926927

927928
if (auto cacheId = reserve_cache_entry(request.spec.name(), abi, cache_size))
928929
{
929930
const std::string custom_headers[] = {
930931
m_token_header,
931932
m_accept_header.to_string(),
932933
"Content-Type: application/octet-stream",
933-
"Content-Range: bytes 0-" + std::to_string(cache_size) + "/*",
934-
};
934+
fmt::format("Content-Range: bytes 0-{}/{}", cache_size - 1, cache_size)};
935935

936936
PrintingDiagnosticContext pdc{msg_sink};
937937
WarningDiagnosticContext wdc{pdc};

0 commit comments

Comments
 (0)