Update Composer packages

This commit is contained in:
Paul Nicoué 2022-12-19 14:56:05 +01:00
parent 0320235f6c
commit a8b68fb61b
378 changed files with 28466 additions and 28852 deletions

View file

@ -46,10 +46,10 @@ class Media
// if at least the token was correct, redirect
if (Str::startsWith($hash, $file->mediaToken() . '-') === true) {
return Response::redirect($file->mediaUrl(), 307);
} else {
// don't leak the correct token, render the error page
return false;
}
// don't leak the correct token, render the error page
return false;
}
// send the file to the browser
@ -97,16 +97,17 @@ class Media
{
$kirby = App::instance();
// assets
if (is_string($model) === true) {
$root = $kirby->root('media') . '/assets/' . $model . '/' . $hash;
// parent files for file model that already included hash
} elseif (is_a($model, '\Kirby\Cms\File')) {
$root = dirname($model->mediaRoot());
// model files
} else {
$root = $model->mediaRoot() . '/' . $hash;
}
$root = match (true) {
// assets
is_string($model)
=> $kirby->root('media') . '/assets/' . $model . '/' . $hash,
// parent files for file model that already included hash
$model instanceof File
=> dirname($model->mediaRoot()),
// model files
default
=> $model->mediaRoot() . '/' . $hash
};
try {
$thumb = $root . '/' . $filename;
@ -117,21 +118,22 @@ class Media
return false;
}
if (is_string($model) === true) {
$source = $kirby->root('index') . '/' . $model . '/' . $options['filename'];
} else {
$source = $model->file($options['filename'])->root();
}
$source = match (true) {
is_string($model) === true
=> $kirby->root('index') . '/' . $model . '/' . $options['filename'],
default
=> $model->file($options['filename'])->root()
};
try {
$kirby->thumb($source, $thumb, $options);
F::remove($job);
return Response::file($thumb);
} catch (Throwable $e) {
} catch (Throwable) {
F::remove($thumb);
return Response::file($source);
}
} catch (Throwable $e) {
} catch (Throwable) {
return false;
}
}