From 956696383513dd23a2c2c71a8a4e1b398dd216ef Mon Sep 17 00:00:00 2001 From: Molkobain Date: Fri, 8 Mar 2024 15:49:47 +0100 Subject: [PATCH] =?UTF-8?q?N=C2=B07157=20-=20Fix=20unit=20test=20when=20us?= =?UTF-8?q?ing=20symlinks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sources/Application/WebPage/WebPage.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sources/Application/WebPage/WebPage.php b/sources/Application/WebPage/WebPage.php index 13795cff1..424aa8264 100644 --- a/sources/Application/WebPage/WebPage.php +++ b/sources/Application/WebPage/WebPage.php @@ -580,7 +580,9 @@ class WebPage implements Page return; } - if (false === utils::RealPath(MODULESROOT . $sFileRelPath, MODULESROOT)) { + $sFileAbsPath = MODULESROOT . $sFileRelPath; + // For modules only, we don't check real path if symlink as the file would not be in under MODULESROOT + if (false === is_link($sFileAbsPath) && false === utils::RealPath($sFileAbsPath, MODULESROOT)) { IssueLog::Warning("Linked resource added to page with a path from outside current env. directory, it will be ignored.", LogChannels::CONSOLE, [ "linked_resource_url" => $sFileRelPath, "request_uri" => $_SERVER['REQUEST_URI'] ?? '' /* CLI */,