diff options
| author | Dan Engelbrecht <[email protected]> | 2024-05-02 17:40:30 +0200 |
|---|---|---|
| committer | GitHub Enterprise <[email protected]> | 2024-05-02 17:40:30 +0200 |
| commit | 1155ed2048a24f4dfcfa65d63243b77973f820d6 (patch) | |
| tree | 49961435a57e3a516506bb6965d021c4864e3ecb /src/zenserver/cache | |
| parent | use write and move in place for safer writing of files (#70) (diff) | |
| download | zen-1155ed2048a24f4dfcfa65d63243b77973f820d6.tar.xz zen-1155ed2048a24f4dfcfa65d63243b77973f820d6.zip | |
fix zero size attachment replies (#69)
- Bugfix: Don't try to respond with zero size partial cache value when partial size is zero
- Improvement: Added more validation of data read from cache / cas
Diffstat (limited to 'src/zenserver/cache')
| -rw-r--r-- | src/zenserver/cache/httpstructuredcache.cpp | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/zenserver/cache/httpstructuredcache.cpp b/src/zenserver/cache/httpstructuredcache.cpp index 135eee57c..449a43653 100644 --- a/src/zenserver/cache/httpstructuredcache.cpp +++ b/src/zenserver/cache/httpstructuredcache.cpp @@ -727,7 +727,15 @@ HttpStructuredCacheService::HandleGetCacheRecord(HttpServerRequest& Request, con if (IoBuffer Chunk = m_CidStore.FindChunkByCid(AttachmentHash.AsHash())) { CompressedBuffer Compressed = CompressedBuffer::FromCompressedNoValidate(std::move(Chunk)); - Package.AddAttachment(CbAttachment(Compressed, AttachmentHash.AsHash())); + if (Compressed) + { + Package.AddAttachment(CbAttachment(Compressed, AttachmentHash.AsHash())); + } + else + { + ZEN_WARN("invalid compressed binary returned for {}", AttachmentHash.AsHash()); + MissingCount++; + } } else { |