Skip to content

Updated S3 signer response codes #461

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

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion dist/vue2Dropzone.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/vue2Dropzone.js.map

Large diffs are not rendered by default.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,10 @@
"author": "rowanwins <@rowanwins>",
"contributors": [
"Vaibhavraj Roham <@vrajroham>",
"Alexander Wennerstrøm <@AlexanderYW>"
"Alexander Wennerstrøm <@AlexanderYW>",
"Kar Kloppenborg <@inventionlabsSydney>"
],
"version": "3.5.8",
"version": "3.5.9",
"license": "MIT",
"main": "./dist/vue2Dropzone.js",
"repository": "[email protected]:rowanwins/vue-dropzone.git",
Expand Down
21 changes: 20 additions & 1 deletion src/services/urlsigner.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,26 @@ export default {
let request = new XMLHttpRequest();
request.open('POST', response.postEndpoint);
request.onload = function () {
if (request.status == 201) {
// Signer should response with
if (response.signature.hasOwnProperty("success_action_status") && request.status == parseInt(response.signature.success_action_status, 10)) {
// Recieved correct response based on the signer. Attempt any messages if needed
if (request.status == 204) {
// This is a no content status. We will resolve as such
resolve({
'success': true,
'message': {'presign': response, 'request': request}
})
} else {
// Purposefully leaving this in as it's part of the original code and I figure I can come back and adjust this later
var s3BodyResponse = (new window.DOMParser()).parseFromString(request.response, "text/xml")
var successMsg = s3BodyResponse.firstChild.children[0].innerHTML;
resolve({
'success': true,
'message': successMsg
})
}
}
else if (request.status == 201) {
var s3Error = (new window.DOMParser()).parseFromString(request.response, "text/xml");
var successMsg = s3Error.firstChild.children[0].innerHTML;
resolve({
Expand Down