Skip to content
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

IE fix for xml parsing #332

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 23 additions & 6 deletions src/services/urlsigner.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,42 @@ export default {
let request = new XMLHttpRequest();
request.open('POST', response.postEndpoint);
request.onload = function () {
var parser = new DOMParser();
var s3Msg = null
try {
s3Msg = parser.parseFromString(request.response, "application/xml");
} catch (err) {
s3Msg = new ActiveXObject("Microsoft.XMLDOM");
s3Msg.async = "false";
s3Msg.loadXML(err)
}

if (request.status == 201) {
var s3Error = (new window.DOMParser()).parseFromString(request.response, "text/xml");
var successMsg = s3Error.firstChild.children[0].innerHTML;
var successMsg = s3Msg.firstChild.children[0].innerHTML;
resolve({
'success': true,
'message': successMsg
})
} else {
var s3Error = (new window.DOMParser()).parseFromString(request.response, "text/xml");
var errMsg = s3Error.firstChild.children[0].innerHTML;
var errMsg = s3Msg.firstChild.children[0].innerHTML;
reject({
'success': false,
'message': errMsg + ". Request is marked as resolved when returns as status 201"
})
}
};
request.onerror = function (err) {
var s3Error = (new window.DOMParser()).parseFromString(request.response, "text/xml");
var errMsg = s3Error.firstChild.children[1].innerHTML;
var parser = new DOMParser();
var s3Msg = null
try {
s3Msg = parser.parseFromString(request.response, "application/xml");
} catch (err2) {
s3Msg = new ActiveXObject("Microsoft.XMLDOM");
s3Msg.async = "false";
s3Msg.loadXML(err2)
}

var errMsg = s3Msg.firstChild.children[1].innerHTML;
reject({
'success': false,
'message': errMsg
Expand Down