mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2025-10-28 16:56:36 +01:00
Improve flash file error detection
This commit is contained in:
@@ -409,10 +409,7 @@ class AdminBaseController
|
|||||||
// Retrieve the current session of the uploaded files for the field
|
// Retrieve the current session of the uploaded files for the field
|
||||||
// and initialize it if it doesn't exist
|
// and initialize it if it doesn't exist
|
||||||
$sessionField = base64_encode($this->grav['uri']->url());
|
$sessionField = base64_encode($this->grav['uri']->url());
|
||||||
$flash = $this->admin->session()->getFlashObject('files-upload');
|
$flash = $this->admin->session()->getFlashObject('files-upload') ?? [];
|
||||||
if (!$flash) {
|
|
||||||
$flash = [];
|
|
||||||
}
|
|
||||||
if (!isset($flash[$sessionField])) {
|
if (!isset($flash[$sessionField])) {
|
||||||
$flash[$sessionField] = [];
|
$flash[$sessionField] = [];
|
||||||
}
|
}
|
||||||
@@ -615,8 +612,8 @@ class AdminBaseController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Retrieve the flash object and remove the requested file from it
|
// Retrieve the flash object and remove the requested file from it
|
||||||
$flash = $this->admin->session()->getFlashObject('files-upload');
|
$flash = $this->admin->session()->getFlashObject('files-upload') ?? [];
|
||||||
$endpoint = $flash[$request->sessionField][$request->field][$request->path];
|
$endpoint = $flash[$request->sessionField][$request->field][$request->path] ?? null;
|
||||||
|
|
||||||
if (isset($endpoint)) {
|
if (isset($endpoint)) {
|
||||||
if (file_exists($endpoint['tmp_name'])) {
|
if (file_exists($endpoint['tmp_name'])) {
|
||||||
|
|||||||
Reference in New Issue
Block a user