Skip to content

Commit

Permalink
Adapters listContents method now changes type blob to type file.
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyVoetman committed Aug 3, 2019
1 parent 19ab109 commit c1015bf
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 4 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ All notable changes to `flysystem-gitlab-storage` will be documented in this fil
### 1.0.4 - 2019-08-03
- Added support for tree path with multiple sub folders.

### 1.0.5- 2019-08-03
### 1.0.5 - 2019-08-03
- Adapters read method now returns an array instead of raw content.

### 1.0.6 - 2019-08-03
- Adapters listContents method now changes type blob to type file.
8 changes: 7 additions & 1 deletion src/GitlabAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,13 @@ public function readStream($path)
public function listContents($directory = '', $recursive = false): array
{
try {
return $this->client->tree($this->applyPathPrefix($directory), $recursive);
$res = $this->client->tree($this->applyPathPrefix($directory), $recursive);

return array_map(function($item) {
$item['type'] = ($item['type'] === 'blob') ? 'file' : $item['type'];

return $item;
}, $res);
} catch (GuzzleException $e) {
return [];
}
Expand Down

0 comments on commit c1015bf

Please sign in to comment.