Skip to content

Commit 4683c45

Browse files
committed
Ensure category image directory is created
1 parent 7cdf058 commit 4683c45

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎Component/Categories.php‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,11 @@ public function createOrUpdateCategory(
137137
$value = BP . '/' . trim((string) $value, '/');
138138
}
139139

140-
if (!$this->driver->copy($value, $catMediaDir . $img)) {
141-
$this->log->logError('Failed to find image: ' . $value, 1);
140+
try {
141+
$this->driver->createDirectory($catMediaDir);
142+
$this->driver->copy($value, $catMediaDir . $img);
143+
} catch (FileSystemException $e) {
144+
$this->log->logError('Failed to copy image "' . $value . '": ' . $e->getMessage(), 1);
142145
break;
143146
}
144147

0 commit comments

Comments
 (0)