CSSResourceLocator: account for symlinks in app path

Currently, if the app path includes a symlink, the calculated webDir
will be incorrect when generating CSS and URLs will be pointing to the
wrong place, breaking CSS.

Use realpath when retrieving app path, and these issues go away.

Fix #6028

Signed-off-by: Kyle Fazzari <kyrofa@ubuntu.com>
This commit is contained in:
Kyle Fazzari 2017-11-03 23:03:34 -07:00
parent 6fd99b4e47
commit b0d296639c
No known key found for this signature in database
GPG Key ID: A7D23FB0E778DEDF
1 changed files with 5 additions and 0 deletions

View File

@ -71,6 +71,11 @@ class CSSResourceLocator extends ResourceLocator {
return; return;
} }
// Account for the possibility of having symlinks in app path. Doing
// this here instead of above as an empty argument to realpath gets
// turned into cwd.
$app_path = realpath($app_path);
if(!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) { if(!$this->cacheAndAppendScssIfExist($app_path, $style.'.scss', $app)) {
$this->append($app_path, $style.'.css', $app_url); $this->append($app_path, $style.'.css', $app_url);
} }