Upgrade to 3.5
This commit is contained in:
@@ -76,8 +76,12 @@ class Blocks extends Items
|
||||
return [];
|
||||
}
|
||||
|
||||
// no layouts
|
||||
if (array_key_exists('columns', $input[0]) === false) {
|
||||
if (
|
||||
// no columns = no layout
|
||||
array_key_exists('columns', $input[0]) === false ||
|
||||
// checks if this is a block for the builder plugin
|
||||
array_key_exists('_key', $input[0]) === true
|
||||
) {
|
||||
return $input;
|
||||
}
|
||||
|
||||
|
@@ -202,15 +202,23 @@ class FileRules
|
||||
* Validates the extension, MIME type and filename
|
||||
*
|
||||
* @param \Kirby\Cms\File $file
|
||||
* @param string|null $mime If not passed, the MIME type is detected from the file
|
||||
* @param string|null|false $mime If not passed, the MIME type is detected from the file,
|
||||
* if `false`, the MIME type is not validated for performance reasons
|
||||
* @return bool
|
||||
* @throws \Kirby\Exception\InvalidArgumentException If the extension, MIME type or filename is missing or forbidden
|
||||
*/
|
||||
public static function validFile(File $file, ?string $mime = null): bool
|
||||
public static function validFile(File $file, $mime = null): bool
|
||||
{
|
||||
if ($mime === false) {
|
||||
// request to skip the MIME check for performance reasons
|
||||
$validMime = true;
|
||||
} else {
|
||||
$validMime = static::validMime($file, $mime ?? $file->mime());
|
||||
}
|
||||
|
||||
return
|
||||
$validMime &&
|
||||
static::validExtension($file, $file->extension()) &&
|
||||
static::validMime($file, $mime ?? $file->mime()) &&
|
||||
static::validFilename($file, $file->filename());
|
||||
}
|
||||
|
||||
|
@@ -71,7 +71,7 @@ class Media
|
||||
public static function publish(File $file, string $dest): bool
|
||||
{
|
||||
// never publish risky files (e.g. HTML, PHP or Apache config files)
|
||||
FileRules::validFile($file);
|
||||
FileRules::validFile($file, false);
|
||||
|
||||
$src = $file->root();
|
||||
$version = dirname($dest);
|
||||
|
@@ -291,9 +291,9 @@ trait UserActions
|
||||
/**
|
||||
* Reads the user password from disk
|
||||
*
|
||||
* @return string|null
|
||||
* @return string|false
|
||||
*/
|
||||
protected function readPassword(): ?string
|
||||
protected function readPassword()
|
||||
{
|
||||
return F::read($this->root() . '/.htpasswd');
|
||||
}
|
||||
|
Reference in New Issue
Block a user