Skip to content

Commit 9aa358a

Browse files
authored
fix: handle video and other resource types gracefully (#143)
This fixes #129
1 parent 7ab9721 commit 9aa358a

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/CloudinaryAdapter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,13 @@ public function directoryExists(string $path): bool
262262
*/
263263
public function read(string $path): string
264264
{
265-
$resource = (array) $this->adminApi()->asset($this->preparePublicId($path));
265+
try {
266+
$resource = (array) $this->adminApi()->asset($this->preparePublicId($path));
267+
} catch (Exception) {
268+
$resource = (array) $this->adminApi()->asset(
269+
$this->preparePublicId($path), ['resource_type' => 'video']
270+
);
271+
}
266272

267273
return file_get_contents($resource['secure_url']);
268274
}

0 commit comments

Comments
 (0)