mdedetrich commented on code in PR #799:
URL: https://github.com/apache/pekko-connectors/pull/799#discussion_r1757127753


##########
google-common/src/main/scala/org/apache/pekko/stream/connectors/google/ResumableUpload.scala:
##########
@@ -93,10 +94,16 @@ private[connectors] object ResumableUpload {
     import implicits._
 
     implicit val um: FromResponseUnmarshaller[Uri] =
-      Unmarshaller.withMaterializer { implicit ec => implicit mat => 
(response: HttpResponse) =>
-        response.discardEntityBytes().future.map { _ =>
-          response.header[Location].fold(throw 
InvalidResponseException(ErrorInfo("No Location header")))(_.uri)
-        }
+      Unmarshaller.withMaterializer { _ => implicit mat => (response: 
HttpResponse) =>
+        if (response.status.isSuccess())
+          response.discardEntityBytes().future.map { _ =>
+            response.header[Location].fold(throw 
InvalidResponseException(ErrorInfo("No Location header")))(_.uri)
+          }(ExecutionContexts.parasitic)
+        else
+          response.entity.dataBytes.runWith(Sink.fold(ByteString.empty)(_ ++ 
_)).flatMap { body =>
+            Future.failed(InvalidResponseException(
+              ErrorInfo(s"Bad response, status code: 
${response.status.intValue()} and body: $body")))

Review Comment:
   Its the exact same as 
https://github.com/apache/pekko-connectors/blob/26fa1742887489828c5e0d46f1ed10f7ac056fc9/google-cloud-storage/src/main/scala/org/apache/pekko/stream/connectors/googlecloud/storage/impl/GCStorageStream.scala#L166-L168
 , in fact I believe the intention was for that code to trigger in this case 
but due to how the order of http requests this didn't happen.
   
   The data appearing in the logs is coming from google cloud storage, not 
anything that would be in the user code.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to