Permalink
Browse files

Update

  • Loading branch information...
1 parent 3cd83e2 commit 7b986e54924debc6f7494ae1146c3db7accbe3f1 jaycanuck committed Apr 3, 2012
Showing with 6 additions and 5 deletions.
  1. +6 −5 xmlprequest/XmlpRequest.js
View
11 xmlprequest/XmlpRequest.js
@@ -44,15 +44,16 @@ enyo.kind({
var prefix = "<html>\n \n \n <head>\n \n \n <meta content=\"HTML Tidy for Java (vers. 26 Sep 2004), see www.w3.org\" name=\"generator\"/>\n \n \n <title/>\n \n \n </head>\n \n \n <body>\n \n \n <p>"
var suffix = "</p>\n \n \n </body>\n \n\n</html>";
inResponse = inResponse.replace(prefix, "");
- inResponse = inResponse.replace(prefix, "");
+
+ inResponse = inResponse.replace(suffix, "");
var iOpen = inResponse.indexOf("<");
var iClose = inResponse.lastIndexOf(">");
+
//if still contains html, we know it wasn't plain text to begin with
- if(iOpen>-1 && iClose>-1 && iClose>iOpen) {
- inResponse = {"error":inResponse};
-
- } else {
+ if(iOpen>-1 && iOpen<iClose) {
inResponse = {"error":"Query is not in XML format"};
+ } else {
+ inResponse = {"error":inResponse};
}
} else if(inResponse && !inResponse.result) {
inResponse = {"error":"Unknown XML query failure"};

0 comments on commit 7b986e5

Please sign in to comment.