From 60c3b6e97b20d2b82762dab756d85433e97e34af Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 8 Apr 2019 22:01:59 -0400 Subject: [PATCH] Skip adding core resources when building assets Adds asset builder url to the whitelist of ajax paths in which we skip adding core resources. --- CRM/Core/Resources.php | 4 ++-- tests/phpunit/CRM/Core/ResourcesTest.php | 1 + 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CRM/Core/Resources.php b/CRM/Core/Resources.php index 55d8461d8f..a7e469cb39 100644 --- a/CRM/Core/Resources.php +++ b/CRM/Core/Resources.php @@ -821,8 +821,8 @@ class CRM_Core_Resources { ) { return TRUE; } - $url = CRM_Utils_System::getUrlPath(); - return (strpos($url, 'civicrm/ajax') === 0) || (strpos($url, 'civicrm/angular') === 0); + list($arg0, $arg1) = array_pad(explode('/', CRM_Utils_System::getUrlPath()), 2, ''); + return ($arg0 === 'civicrm' && in_array($arg1, ['ajax', 'angularprofiles', 'asset'])); } /** diff --git a/tests/phpunit/CRM/Core/ResourcesTest.php b/tests/phpunit/CRM/Core/ResourcesTest.php index c9b76195ee..55b2c7197f 100644 --- a/tests/phpunit/CRM/Core/ResourcesTest.php +++ b/tests/phpunit/CRM/Core/ResourcesTest.php @@ -350,6 +350,7 @@ class CRM_Core_ResourcesTest extends CiviUnitTestCase { return array( array(array('q' => 'civicrm/ajax/foo'), TRUE), array(array('q' => 'civicrm/angularprofiles/template'), TRUE), + array(array('q' => 'civicrm/asset/builder'), TRUE), array(array('q' => 'civicrm/test/page'), FALSE), array(array('q' => 'civicrm/test/page', 'snippet' => 'json'), TRUE), array(array('q' => 'civicrm/test/page', 'snippet' => 'foo'), FALSE), -- 2.25.1