in sdk/src/resumable/ResumableDownloader.cc [336:372]
int ResumableDownloader::validateRecord()
{
auto record = record_;
if (record.size != fileSize_ || record.mtime != request_.FileMtime() ||
record.contentHash != contentHash_) {
return ARG_ERROR_DOWNLOAD_SOURCE_FILE_MODIFIED;
}
Json::Value root;
root["opType"] = record.opType;
root["driveID"] = record.driveID;
root["shareID"] = record.shareID;
root["fileID"] = record.fileID;
root["contentHash"] = record.contentHash;
root["filePath"] = record.filePath;
root["mtime"] = record.mtime;
root["size"] = record.size;
root["partSize"] = record.partSize;
root["parts"].resize(0);
int index = 0;
for (PartRecord& part : record.parts) {
root["parts"][index]["partNumber"] = part.partNumber;
root["parts"][index]["size"] = part.size;
root["parts"][index]["crc64"] = part.crc64;
index++;
}
std::stringstream recordStream;
recordStream << root;
std::string md5Sum = ComputeContentETag(recordStream);
if (md5Sum != record.md5Sum) {
return -1;
}
return 0;
}