Bug #1716

Unexpected convertion on XML special characters when display a vm template in sunstone.

Added by WH Wang over 8 years ago. Updated over 8 years ago.

Status:ClosedStart date:01/08/2013
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Sunstone
Target version:-
Resolution:duplicate Pull request:
Affected Versions:OpenNebula 3.8

Description

There is a bug in sunstone v3.8.1.
When update or show a vm template content in sunstone, the XML special characters are converted unexpected.

For example:

Template content:

RAW=[
DATA="
<features>
<apic/>
</features>",
TYPE="KVM" ]

Will be converted to:

RAW=[
DATA="
<features>
<apic/>
</features>",
TYPE="KVM" ]

The code causes the problem is in opennebula.js at row 20.
$.ajaxSetup({
converters: {
"text json": function( textValue ) {
// Here jQuery.html() caused the problem
return jQuery.parseJSON(jQuery('<div/>').text(textValue).html());
}
}

I fixed by using the default convertion in Opennebula.Action.show.

--- opennebula-3.8.1/src/sunstone/public/js/opennebula.js 2012-10-26 23:30:33.000000000 +0800
+++ opennebula-3.8.1-patched/src/sunstone/public/js/opennebula.js 2012-11-10 03:25:13.000000000 +0800
@ -302,6 +302,9 @
url: url,
type: "GET",
dataType: "json",
+ converters: {
+ "text json": jQuery.parseJSON
+ },
success: function(response){
return callback ? callback(request, response) : null;
},
});

sunstone-001.patch Magnifier - My patch file (551 Bytes) WH Wang, 01/08/2013 07:41 AM

History

#1 Updated by WH Wang over 8 years ago

I re-created the issue in #1717

#2 Updated by Carlos Martín over 8 years ago

  • Status changed from New to Closed
  • Resolution set to duplicate

Also available in: Atom PDF