| 253 | } |
| 254 | |
| 255 | std::optional<uint64_t> zipStreamSize(const std::vector<SendFile>& files, const std::vector<std::string>& dirs) |
| 256 | { |
| 257 | uint64_t total = 22; // end of central directory |
| 258 | for (const auto& dir : dirs) { |
| 259 | total += 30 + dir.size(); // local header |
| 260 | total += 46 + dir.size(); // central directory |
| 261 | } |
| 262 | for (const auto& entry : files) { |
| 263 | total += 30 + entry.relPath.size() + (uint64_t)entry.size + 16; // local header + data + data descriptor |
| 264 | total += 46 + entry.relPath.size(); // central directory |
| 265 | } |
| 266 | if (total > kZipMaxSize) { |
| 267 | return std::nullopt; |
| 268 | } |
| 269 | return total; |
| 270 | } |
| 271 | |
| 272 | bool parseMultipart(const std::string& head, uint64_t bodyLen, const std::string& boundary, std::string& outMeta, uint64_t& outFileOffset, |
| 273 | uint64_t& outFileLen, std::string& outError) |
no test coverage detected