Check if given partial name is also file or only folder (#3190)

Fixes #2383. Credit to @vojtasvoboda, reviewed by @CptMeatball
This commit is contained in:
Vojta Svoboda 2017-10-23 16:48:34 +02:00 committed by Luke Towers
parent dc16902fca
commit 04cb4ddd2c
1 changed files with 2 additions and 1 deletions

View File

@ -78,7 +78,8 @@ trait ViewMaker
*/
public function makePartial($partial, $params = [], $throwException = true)
{
if (!File::isPathSymbol($partial) && realpath($partial) === false) {
$notRealPath = realpath($partial) === false || is_dir($partial) === true;
if (!File::isPathSymbol($partial) && $notRealPath) {
$folder = strpos($partial, '/') !== false ? dirname($partial) . '/' : '';
$partial = $folder . '_' . strtolower(basename($partial)).'.htm';
}