mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-07 14:36:16 +02:00
Fix for grav#2100 - deleting @2x media files
This commit is contained in:
@@ -1826,7 +1826,13 @@ class AdminController extends AdminBaseController
|
||||
// Remove Extra Files
|
||||
foreach (scandir($media->path(), SCANDIR_SORT_NONE) as $file) {
|
||||
if (preg_match("/{$fileParts['filename']}@\d+x\.{$fileParts['extension']}(?:\.meta\.yaml)?$|{$filename}\.meta\.yaml$/", $file)) {
|
||||
$result = unlink($media->path() . '/' . $file);
|
||||
|
||||
$targetPath = $media->path() . '/' . $file;
|
||||
if ($locator->isStream($targetPath)) {
|
||||
$targetPath = $locator->findResource($targetPath, true, true);
|
||||
}
|
||||
|
||||
$result = unlink($targetPath);
|
||||
|
||||
if (!$result) {
|
||||
$this->admin->json_response = [
|
||||
|
||||
Reference in New Issue
Block a user