mirror of
https://github.com/getgrav/grav.git
synced 2026-05-06 04:36:13 +02:00
Fixed an error when trying to delete a file from non-existing Flex Object
This commit is contained in:
@@ -17,6 +17,7 @@
|
||||
* Fixed fatal error 'Expiration date must be an integer, a DateInterval or null, "double" given' [#2529](https://github.com/getgrav/grav/issues/2529)
|
||||
* Fixed non-existing Flex object having a bad media folder
|
||||
* Fixed collections using `page@.self:` should allow modular pages if requested
|
||||
* Fixed an error when trying to delete a file from non-existing Flex Object
|
||||
|
||||
# v1.6.11
|
||||
## 06/21/2019
|
||||
|
||||
@@ -153,6 +153,12 @@ trait FlexMediaTrait
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $grav['locator'];
|
||||
$path = $media->getPath();
|
||||
if (!$path) {
|
||||
$language = $grav['language'];
|
||||
|
||||
throw new RuntimeException($language->translate('PLUGIN_ADMIN.FAILED_TO_MOVE_UPLOADED_FILE'), 400);
|
||||
}
|
||||
|
||||
if ($locator->isStream($path)) {
|
||||
$path = $locator->findResource($path, true, true);
|
||||
$locator->clearCache($path);
|
||||
@@ -202,12 +208,16 @@ trait FlexMediaTrait
|
||||
}
|
||||
|
||||
$media = $this->getMedia();
|
||||
$path = $media->getPath();
|
||||
if (!$path) {
|
||||
return;
|
||||
}
|
||||
|
||||
/** @var UniformResourceLocator $locator */
|
||||
$locator = $grav['locator'];
|
||||
|
||||
$targetPath = $media->getPath() . '/' . $dirname;
|
||||
$targetFile = $media->getPath() . '/' . $filename;
|
||||
$targetPath = $path . '/' . $dirname;
|
||||
$targetFile = $path . '/' . $filename;
|
||||
if ($locator->isStream($targetFile)) {
|
||||
$targetPath = $locator->findResource($targetPath, true, true);
|
||||
$targetFile = $locator->findResource($targetFile, true, true);
|
||||
|
||||
Reference in New Issue
Block a user