From 99c8d61f5cf283b6f1a59cb113dfde1655221501 Mon Sep 17 00:00:00 2001 From: Ere Maijala <ere.maijala@helsinki.fi> Date: Thu, 20 Dec 2018 16:18:05 +0200 Subject: [PATCH] Use realpath when concatenating files. (#1296) - Fixes problems related to symlinks. --- .../VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php b/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php index c6b5037d9c3..72ef3705df4 100644 --- a/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php +++ b/module/VuFindTheme/src/VuFindTheme/View/Helper/ConcatTrait.php @@ -230,7 +230,10 @@ trait ConcatTrait } // Locate/create concatenated asset file $filename = md5($group['key']) . '.min.' . $this->getFileType(); - $concatPath = $this->getResourceCacheDir() . $filename; + // Minifier uses realpath, so do that here too to make sure we're not + // pointing to a symlink. Otherwise the path converter won't find the correct + // shared directory part. + $concatPath = realpath($this->getResourceCacheDir()) . '/' . $filename; if (!file_exists($concatPath)) { $lockfile = "$concatPath.lock"; $handle = fopen($lockfile, 'c+'); @@ -276,6 +279,7 @@ trait ConcatTrait . $this->getResourceFilePath($item), ThemeInfo::RETURN_ALL_DETAILS ); + $details['path'] = realpath($details['path']); $data[] = $this->getMinifiedData($details, $concatPath); } // Separate each file's data with a new line so that e.g. a file -- GitLab