diff --git a/vendor/magento/module-aws-s3/Driver/AwsS3.php b/vendor/magento/module-aws-s3/Driver/AwsS3.php
index def5088e89326..07657d373c95a 100644
--- a/vendor/magento/module-aws-s3/Driver/AwsS3.php
+++ b/vendor/magento/module-aws-s3/Driver/AwsS3.php
@@ -257,7 +257,7 @@ public function deleteDirectory($path): bool
     /**
      * @inheritDoc
      */
-    public function filePutContents($path, $content, $mode = null): int
+    public function filePutContents($path, $content, $mode = null): bool|int
     {
         $path = $this->normalizeRelativePath($path, true);
         $config = self::CONFIG;
@@ -272,10 +272,11 @@ public function filePutContents($path, $content, $mode = null): int
 
         try {
             $this->adapter->write($path, $content, new Config($config));
-            return $this->adapter->fileSize($path)->fileSize();
+            return ($this->adapter->fileSize($path)->fileSize() !== null)??true;
+
         } catch (FlysystemFilesystemException | UnableToRetrieveMetadata $e) {
             $this->logger->error($e->getMessage());
-            return 0;
+            return false;
         }
     }
 
