mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-11-02 03:16:11 +01:00
Don't reveal Grav filesystem path when trying to delete non-existing images
This commit is contained in:
@@ -679,18 +679,20 @@ class AdminController
|
||||
} else {
|
||||
//Try with responsive images @1x, @2x, @3x
|
||||
$ext = pathinfo($targetPath, PATHINFO_EXTENSION);
|
||||
$filename = $page->path() . '/'. basename($targetPath, ".$ext");
|
||||
$responsiveTargetPath = $filename . '@1x.' . $ext;
|
||||
$fullPathFilename = $page->path() . '/'. basename($targetPath, ".$ext");
|
||||
$responsiveTargetPath = $fullPathFilename . '@1x.' . $ext;
|
||||
|
||||
$deletedResponsiveImage = false;
|
||||
if (file_exists($responsiveTargetPath) && unlink($responsiveTargetPath)) {
|
||||
$deletedResponsiveImage = true;
|
||||
}
|
||||
|
||||
$responsiveTargetPath = $filename . '@2x.' . $ext;
|
||||
$responsiveTargetPath = $fullPathFilename . '@2x.' . $ext;
|
||||
if (file_exists($responsiveTargetPath) && unlink($responsiveTargetPath)) {
|
||||
$deletedResponsiveImage = true;
|
||||
}
|
||||
$responsiveTargetPath = $filename . '@3x.' . $ext;
|
||||
|
||||
$responsiveTargetPath = $fullPathFilename . '@3x.' . $ext;
|
||||
if (file_exists($responsiveTargetPath) && unlink($responsiveTargetPath)) {
|
||||
$deletedResponsiveImage = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user