From bb63c1c6041659dc076c82e764fe9097653897e1 Mon Sep 17 00:00:00 2001 From: Tim Starling Date: Mon, 30 Apr 2007 10:28:21 +0000 Subject: [PATCH] More general thumbnail filename check on purge, to allow for general parameter strings --- includes/Image.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/includes/Image.php b/includes/Image.php index 0c40c92eb8..8cc8c39597 100644 --- a/includes/Image.php +++ b/includes/Image.php @@ -1075,7 +1075,9 @@ class Image $urls = array(); foreach ( $files as $file ) { $m = array(); - if ( preg_match( '/^\d+px/', $file, $m ) ) { + # Check that the base image name is part of the thumb name + # This is a basic sanity check to avoid erasing unrelated directories + if ( strpos( $file, $this->name ) !== false ) { $url = $this->thumbUrlFromName( $file ); $urls[] = $url; @unlink( "$dir/$file" ); -- 2.20.1