1
0
mirror of https://github.com/OpenNebula/one.git synced 2025-03-23 22:50:09 +03:00

Fix missing string encoding

Thanks to Jérémie Simon for reporting it.
This commit is contained in:
Carlos Martín 2016-09-14 18:45:32 +02:00
parent e9f1466d23
commit 115bd6da57
4 changed files with 39 additions and 18 deletions

View File

@ -139,7 +139,7 @@ define(function(require) {
}
// Build hidden user template
var hidden_template = TemplateUtils.templateToString(element);
var hidden_template = TemplateUtils.htmlEncode(TemplateUtils.templateToString(element));
var search = {
NAME: element.NAME,

View File

@ -22,6 +22,7 @@ define(function(require) {
var Locale = require('utils/locale');
var Humanize = require('utils/humanize');
var TemplateUtils = require('utils/template-utils');
var TemplateHtml = require('hbs!./template/html');
/*
CONSTANTS
@ -56,22 +57,10 @@ define(function(require) {
*/
function _html() {
return '<div class="row">'+
'<div class="large-12 columns">'+
'<h5>' + Locale.tr("User template") + '</h5>'+
'<pre class="template-pre monospace">'+
TemplateUtils.templateToString(this.element.USER_TEMPLATE)+
'</pre>'+
'</div>'+
'</div>'+
'<div class="row">'+
'<div class="large-12 columns">'+
'<h5>' + Locale.tr("Template") + '</h5>'+
'<pre class="template-pre monospace">'+
TemplateUtils.templateToString(this.element.TEMPLATE)+
'</pre>'+
'</div>'+
'</div>';
return TemplateHtml({
userTemplateString: TemplateUtils.templateToString(this.element.USER_TEMPLATE),
templateString: TemplateUtils.templateToString(this.element.TEMPLATE)
});
}
function _setup(context) {

View File

@ -0,0 +1,32 @@
{{! -------------------------------------------------------------------------- }}
{{! Copyright 2002-2016, OpenNebula Project, OpenNebula Systems }}
{{! }}
{{! Licensed under the Apache License, Version 2.0 (the "License"); you may }}
{{! not use this file except in compliance with the License. You may obtain }}
{{! a copy of the License at }}
{{! }}
{{! http://www.apache.org/licenses/LICENSE-2.0 }}
{{! }}
{{! Unless required by applicable law or agreed to in writing, software }}
{{! distributed under the License is distributed on an "AS IS" BASIS, }}
{{! WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. }}
{{! See the License for the specific language governing permissions and }}
{{! limitations under the License. }}
{{! -------------------------------------------------------------------------- }}
<div class="row">
<div class="large-12 columns">
<h5>{{tr "User template"}}</h5>
<pre class="template-pre monospace">
{{~userTemplateString~}}
</pre>
</div>
</div>
<div class="row">
<div class="large-12 columns">
<h5>{{tr "Template"}}</h5>
<pre class="template-pre monospace">
{{~templateString~}}
</pre>
</div>
</div>

View File

@ -124,7 +124,7 @@ define(function(require) {
OpenNebulaVM.ipsStr(element),
Humanize.prettyTime(element.STIME),
vncIcon,
TemplateUtils.templateToString(element),
TemplateUtils.htmlEncode(TemplateUtils.templateToString(element)),
(LabelsUtils.labelsStr(element[TEMPLATE_ATTR])||''),
btoa(unescape(encodeURIComponent(JSON.stringify(search))))
];