diff --git a/src/Assets/AbstractCustomAsset.php b/src/Assets/AbstractCustomAsset.php index 193d2f030..f8f1a4173 100644 --- a/src/Assets/AbstractCustomAsset.php +++ b/src/Assets/AbstractCustomAsset.php @@ -83,6 +83,6 @@ abstract class AbstractCustomAsset implements CustomAssetInterface protected function ensureDirectoryExists(string $path): void { - (new Filesystem())->mkdir(dirname($path)); + (new Filesystem())->mkdir($path); } } diff --git a/src/Assets/AlbumArtCustomAsset.php b/src/Assets/AlbumArtCustomAsset.php index f2f331785..50c3bcb02 100644 --- a/src/Assets/AlbumArtCustomAsset.php +++ b/src/Assets/AlbumArtCustomAsset.php @@ -38,7 +38,7 @@ final class AlbumArtCustomAsset extends AbstractMultiPatternCustomAsset $pattern = $patterns[$mimeType] ?? $patterns['default']; $destPath = $this->getPathForPattern($pattern); - $this->ensureDirectoryExists($destPath); + $this->ensureDirectoryExists(dirname($destPath)); $newImage->save($destPath, 90); } diff --git a/src/Assets/BackgroundCustomAsset.php b/src/Assets/BackgroundCustomAsset.php index fa7b0320d..8ba956ef5 100644 --- a/src/Assets/BackgroundCustomAsset.php +++ b/src/Assets/BackgroundCustomAsset.php @@ -38,7 +38,7 @@ final class BackgroundCustomAsset extends AbstractMultiPatternCustomAsset $pattern = $patterns[$mimeType] ?? $patterns['default']; $destPath = $this->getPathForPattern($pattern); - $this->ensureDirectoryExists($destPath); + $this->ensureDirectoryExists(dirname($destPath)); $newImage->save($destPath, 90); } diff --git a/src/Assets/BrowserIconCustomAsset.php b/src/Assets/BrowserIconCustomAsset.php index 19612950b..68ed15519 100644 --- a/src/Assets/BrowserIconCustomAsset.php +++ b/src/Assets/BrowserIconCustomAsset.php @@ -40,6 +40,8 @@ final class BrowserIconCustomAsset extends AbstractCustomAsset public function upload(Image $image): void { + $this->delete(); + $uploadsDir = $this->environment->getUploadsDirectory() . '/browser_icon'; $this->ensureDirectoryExists($uploadsDir);