| 227 | } |
| 228 | |
| 229 | std::optional<uint64_t> zipStreamSize(const std::vector<SendFile>& files, const std::vector<std::string>& dirs) |
| 230 | { |
| 231 | uint64_t total = 22; // end of central directory |
| 232 | for (const auto& dir : dirs) { |
| 233 | total += 30 + dir.size(); // local header |
| 234 | total += 46 + dir.size(); // central directory |
| 235 | } |
| 236 | for (const auto& entry : files) { |
| 237 | total += 30 + entry.relPath.size() + (uint64_t)entry.size + 16; // local header + data + data descriptor |
| 238 | total += 46 + entry.relPath.size(); // central directory |
| 239 | } |
| 240 | if (total > kZipMaxSize) { |
| 241 | return std::nullopt; |
| 242 | } |
| 243 | return total; |
| 244 | } |
| 245 | |
| 246 | bool parseMultipart(const std::string& head, uint64_t bodyLen, const std::string& boundary, std::string& outMeta, uint64_t& outFileOffset, |
| 247 | uint64_t& outFileLen, std::string& outError) |
no test coverage detected