@@ -375,6 +375,10 @@ int CcdbApi::storeAsBinaryFile(const char* buffer, size_t size, const std::strin
375375 sanitizedEndValidityTimestamp = getFutureTimestamp(60 * 60 * 24 * 1);
376376 }
377377 if (mInSnapshotMode) { // write local file
378+ if (filename.empty() || buffer == nullptr || size == 0) {
379+ LOGP(alarm, "Snapshot mode does not support headers-only upload");
380+ return -3;
381+ }
378382 auto pthLoc = getSnapshotDir(mSnapshotTopPath, path);
379383 o2::utils::createDirectoriesIfAbsent(pthLoc);
380384 auto flLoc = getSnapshotFile(mSnapshotTopPath, path, filename);
@@ -418,8 +422,14 @@ int CcdbApi::storeAsBinaryFile(const char* buffer, size_t size, const std::strin
418422 auto mime = curl_mime_init(curl);
419423 auto field = curl_mime_addpart(mime);
420424 curl_mime_name(field, "send");
421- curl_mime_filedata(field, filename.c_str());
422- curl_mime_data(field, buffer, size);
425+ if (filename.empty()) {
426+ curl_mime_filedata(field, filename.c_str());
427+ }
428+ if (buffer != nullptr && size > 0) {
429+ curl_mime_data(field, buffer, size);
430+ } else {
431+ curl_mime_data(field, "", 0);
432+ }
423433
424434 struct curl_slist* headerlist = nullptr;
425435 static const char buf[] = "Expect:";
0 commit comments