-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix JS bundle URL escape #1465
Fix JS bundle URL escape #1465
Conversation
@@ -61,7 +61,7 @@ | |||
// ****** CREATING CUSTOM VUE USING EXTERNAL COMPONENT ***************************** | |||
\atk4\ui\Header::addTo($app, ['External Component', 'subHeader' => 'Creating component using an external component definition.']); | |||
|
|||
$app->requireJs('https://unpkg.com/vue-clock2@1.1.5/dist/vue-clock.min'); | |||
$app->requireJs('https://unpkg.com/vue-clock2@1.1.5/dist/vue-clock.min.js'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just prevent unneeded redirect...
src/App.php
Outdated
@@ -465,7 +465,7 @@ public function initIncludes() | |||
$this->requireCss($this->cdn['atk'] . '/agileui.css'); | |||
|
|||
// Set js bundle dynamic loading path. | |||
$this->html->template->trySet('PublicPath', $this->cdn['atk']); | |||
$this->html->template->trySet('InitJsBundle', (new JsExpression('window.__atkBundlePublicPath=[]', [$this->cdn['atk']]))->jsRender(), false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
jsRender can not close script tag, thus 100% safe to not escape by definition
* @param array $args | ||
*/ | ||
public function __construct($template = '', $args = []) | ||
public function __construct(string $template = '', array $args = []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array tag type is super important - otherwise string can be passed without any warning!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
we must escape for JS/JSON, not using HTML