Skip to content

Commit 37d4969

Browse files
committed
♻️ Added tests for the CI
1 parent 8a5f0c4 commit 37d4969

File tree

3 files changed

+403
-18
lines changed

3 files changed

+403
-18
lines changed

src/FlysystemCloudinaryAdapter.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
use Cloudinary\Api\Exception\RateLimited;
1010
use Cloudinary\Cloudinary;
1111
use CodebarAg\FlysystemCloudinary\Events\FlysystemCloudinaryResponseLog;
12+
use Illuminate\Http\Client\RequestException;
1213
use Illuminate\Support\Arr;
14+
use Illuminate\Support\Facades\Http;
1315
use League\Flysystem\Adapter\AbstractAdapter;
1416
use League\Flysystem\Adapter\Polyfill\NotSupportingVisibilityTrait;
1517
use League\Flysystem\Config;
@@ -354,11 +356,11 @@ protected function readObject(string $path): array | bool
354356

355357
event(new FlysystemCloudinaryResponseLog($response));
356358

357-
['url' => $url] = $response->getArrayCopy();
359+
['secure_url' => $url] = $response->getArrayCopy();
358360

359-
$contents = file_get_contents($url);
360-
361-
if ($contents === false) {
361+
try {
362+
$contents = Http::get($url)->throw()->body();
363+
} catch (RequestException) {
362364
return false;
363365
}
364366

@@ -388,6 +390,8 @@ public function listContents($directory = '', $recursive = false): array
388390
return [];
389391
}
390392

393+
event(new FlysystemCloudinaryResponseLog($response));
394+
391395
return array_map(function (array $resource) {
392396
return $this->normalizeResponse($resource, $resource['public_id']);
393397
}, $response->getArrayCopy()['resources']);

0 commit comments

Comments
 (0)