diff --git a/services/blob/src/Reactors/server/PutReactor.h b/services/blob/src/Reactors/server/PutReactor.h --- a/services/blob/src/Reactors/server/PutReactor.h +++ b/services/blob/src/Reactors/server/PutReactor.h @@ -20,6 +20,7 @@ std::unique_ptr s3Path; std::shared_ptr blobItem; std::unique_ptr uploader; + bool dataExists = false; public: std::unique_ptr handleRequest( @@ -43,6 +44,7 @@ this->s3Path = std::make_unique(this->blobItem->getS3Path()); response->set_dataexists(true); + this->dataExists = true; return std::make_unique( grpc::Status::OK, true); } @@ -73,8 +75,14 @@ if (!this->status.status.ok()) { return; } - if (!this->readingAborted || this->uploader == nullptr) { - throw std::runtime_error(this->status.status.error_message()); + if (this->uploader == nullptr && !this->dataExists) { + throw std::runtime_error("uploader not initialized as expected"); + } + if (this->uploader == nullptr) { + return; + } + if (!this->readingAborted) { + return; } if (!currentChunk.empty()) { this->uploader->addPart(this->currentChunk);