PDA

View Full Version : [FIXED][2.2/3.0RC1] No XML response processing on file Uploads



quixit
1 May 2009, 7:55 AM
After uploading a file with a BasicForm and option fileUpload = true, the given XML result won't be proccessed.

imho the problem is, that in snippet 1 the response is only processed with a given responseText. In snippet 2 responseText is initialized with an empty string, but if the server answers XML, the responseText wont be be touched, so its still empty and afterwards it wont be processed.

Same Problem is in 2.2 and was discussed in
http://extjs.com/forum/showthread.php?t=6076

Snippet 1 source/widgets/form/Action.js line 200:


// private
processResponse : function(response){
this.response = response;
if(!response.responseText){
return true;
}
this.result = this.handleResponse(response);
return this.result;
},
snippet 2 source/data/core/Connection.js line 142:


function cb(){
var me = this,
// bogus response object
r = {responseText : '',
responseXML : null,
argument : o.argument},
doc,
firstChild;

try {
doc = frame.contentWindow.document || frame.contentDocument || WINDOW.frames[id].document;
if (doc) {
if (doc.body) {
if (/textarea/i.test((firstChild = doc.body.firstChild || {}).tagName)) { // json response wrapped in textarea
r.responseText = firstChild.value;
} else {
r.responseText = doc.body.innerHTML;
}
} else {
responseXML = doc.XMLDocument || doc;
// with XML we are here, and responseText is still empty
}
}
}
catch(e) {}

quixit
3 May 2009, 1:43 AM
Hey there,
I think this could be a fix:

source/widgets/form/Action.js line 200:


// private
processResponse : function(response){
this.response = response;
if(!response.responseText&&!response.responseXML){
return true;
}
this.result = this.handleResponse(response);
return this.result;
},
regards, Thomas

aconran
4 May 2009, 10:33 AM
Thanks for the bug report.

evant
5 May 2009, 8:55 AM
Agree with your fix, it's been committed to SVN.

quixit
5 May 2009, 9:18 AM
Thank you for your work and developing this wonderful Framework!

regards, Thomas