Explorar o código

Clarify exception message when an empty response is returned

Jordi Boggiano %!s(int64=12) %!d(string=hai) anos
pai
achega
81f1451118
Modificáronse 1 ficheiros con 4 adicións e 0 borrados
  1. 4 0
      src/Composer/Util/RemoteFilesystem.php

+ 4 - 0
src/Composer/Util/RemoteFilesystem.php

@@ -172,6 +172,10 @@ class RemoteFilesystem
 
         // handle copy command if download was successful
         if (false !== $result && null !== $fileName) {
+            if ('' === $result) {
+                throw new TransportException('"'.$this->fileUrl.'" appears broken, and returned an empty 200 response');
+            }
+
             $errorMessage = '';
             set_error_handler(function ($code, $msg) use (&$errorMessage) {
                 if ($errorMessage) {