From f38a63e1f256935f77be85872d085731351bf0bd Mon Sep 17 00:00:00 2001 From: philipp lang Date: Mon, 20 Sep 2021 00:29:21 +0200 Subject: [PATCH] Fix: Fetch compressor only once --- lib/MediaPath.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/MediaPath.php b/lib/MediaPath.php index 1d5b37e..5c29301 100644 --- a/lib/MediaPath.php +++ b/lib/MediaPath.php @@ -89,8 +89,10 @@ class MediaPath { $return = collect([]); + $extensionRegex = $this->compressor()->getExtensionRegex(); + foreach (Storage::files($this->versionsDirPath()) as $file) { - if (!preg_match_all('|('.preg_quote($this->filename(), '|').')(-[0-9]+x[0-9]+)?(\.'.$this->compressor()->getExtensionRegex().'+)$|', $file, $matches)) { + if (!preg_match_all('|('.preg_quote($this->filename(), '|').')(-[0-9]+x[0-9]+)?(\.'.$extensionRegex.'+)$|', $file, $matches)) { continue; }