Skip to content

Commit cc892d4

Browse files
Merge pull request #35 from JeremyDunn/fix-flysystem-adapter
CloudinaryAdapter fixes
2 parents ab0dc2d + 2636302 commit cc892d4

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/CloudinaryAdapter.php

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
use League\Flysystem\Config;
1010
use Illuminate\Support\Str;
1111

12-
1312
/**
1413
* Class CloudinaryAdapter
1514
* @package CloudinaryLabs\CloudinaryLaravel
@@ -228,7 +227,12 @@ public function createDir($dirname, Config $options)
228227
*/
229228
public function has($path)
230229
{
231-
return file_exists($path);
230+
try {
231+
$this->adminApi()->asset($path);
232+
} catch (NotFound $e) {
233+
return false;
234+
}
235+
return true;
232236
}
233237

234238
/**
@@ -240,7 +244,7 @@ public function has($path)
240244
*/
241245
public function read($path)
242246
{
243-
$resource = (array)$this->adminApi()->resource($path);
247+
$resource = (array)$this->adminApi()->asset($path);
244248
$contents = file_get_contents($resource['secure_url']);
245249

246250
return compact('contents', 'path');
@@ -266,8 +270,7 @@ public function readStream($path)
266270
* List contents of a directory.
267271
*
268272
* @param string $directory
269-
* @param bool $hasR ecursive
270-
*
273+
* @param bool $hasRecursive
271274
* @return array
272275
*/
273276
public function listContents($directory = '', $hasRecursive = false)

0 commit comments

Comments
 (0)