Skip to content

Commit

Permalink
Merge branch 'release/1.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
jnovermars committed Jul 12, 2022
2 parents d4d9e06 + 6ccb8cd commit 0cc7d4a
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/FlysystemSharepointAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
namespace GWSN\FlysystemSharepoint;

use League\Flysystem\Config;
use League\Flysystem\DirectoryAttributes;
use League\Flysystem\FileAttributes;
use League\Flysystem\FilesystemAdapter;
use League\Flysystem\StorageAttributes;
Expand Down Expand Up @@ -213,7 +214,21 @@ public function fileSize(string $path): FileAttributes
*/
public function listContents(string $path, bool $deep): iterable
{
return $this->connector->getFolder()->requestFolderItems($this->applyPrefix($path));
$content = [];
$result = $this->connector->getFolder()->requestFolderItems($this->applyPrefix($path));

if(count($result) > 0) {
foreach($result as $value) {
if(isset($value['folder'])) {
$content[] = new DirectoryAttributes($value['name'], 'notSupported', (new \DateTime($value['lastModifiedDateTime']))->getTimestamp(), $value);
}
if(isset($value['file'])) {
$content[] = new FileAttributes($value['name'], $value['size'], 'notSupported', (new \DateTime($value['lastModifiedDateTime']))->getTimestamp(), $value['file']['mimeType'], $value);
}
}
}

return $content;
}

/**
Expand Down

0 comments on commit 0cc7d4a

Please sign in to comment.