From abce877f02ae70a11bf0c2221af5960912fd71da Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Fri, 28 Jul 2017 10:42:20 -0400 Subject: [PATCH] Fix issue processwire/processwire-issues#329 Pagefile::install() method when used with URL argument that contains a query string was screwing up the file extension in the basename --- wire/core/Pagefile.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/wire/core/Pagefile.php b/wire/core/Pagefile.php index ba8e6db5..368971aa 100644 --- a/wire/core/Pagefile.php +++ b/wire/core/Pagefile.php @@ -118,8 +118,17 @@ class Pagefile extends WireData { * */ protected function ___install($filename) { + + $basename = $filename; + + if(strpos($basename, '?') !== false) { + list($basename, $queryString) = explode('?', $basename); + if($queryString) {} // do not use in basename + } + + if(empty($basename)) throw new WireException("Empty filename"); - $basename = $this->pagefiles->cleanBasename($filename, true, false, true); + $basename = $this->pagefiles->cleanBasename($basename, true, false, true); $pathInfo = pathinfo($basename); $basename = basename($basename, ".$pathInfo[extension]");