Skip to content

Commit

Permalink
Fixed bug that type hint error for FileAttributes::fileSize.
Browse files Browse the repository at this point in the history
  • Loading branch information
limingxinleo committed Jul 6, 2022
1 parent b186095 commit d3cbab5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,12 @@ public function lastModified(string $path): FileAttributes
public function fileSize(string $path): FileAttributes
{
$response = $this->client->getObjectMeta($this->bucket, $path);
return new FileAttributes($path, $response['content-length']);

$fileSize = null;
if (isset($response['content-length'])) {
$fileSize = (int) $response['content-length'];
}
return new FileAttributes($path, $fileSize);
}

public function listContents(string $path, bool $deep): iterable
Expand Down

0 comments on commit d3cbab5

Please sign in to comment.