-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
acceptedFiles
is not respected for S3 upload
#300
Comments
Your files are being uploaded successfully, but there's little issue after
upload. When file is uploaded to S3 same file is sent to server as well and
that functionality is giving the error. (Soon we will have a support to
optional file sending to server, we have an active PR for that).
Check your server code where S3 object URL is sent.
…On Mar 8, 2018 12:07 AM, "Phuc Tran" ***@***.***> wrote:
I'm following the example for S3 direct upload, and I've also specified
acceptedFiles in the dropzoneOptions config object. I can see the
uploaded file shown as an error, however it actually was still uploaded
successfully on to my S3 bucket. Here's my code:
// Component<vue-dropzone
ref="myVueDropzone"
id="dropzone"
:awss3="awss3"
:options="dropzoneOptions"
@vdropzone-error="dropzoneError"
v-on:vdropzone-s3-upload-error="s3UploadError"
v-on:vdropzone-s3-upload-success="s3UploadSuccess"></vue-dropzone>
// Dropzone config object
dropzoneOptions: {
url: 'https://httpbin.org/post',
thumbnailWidth: 150,
maxFilesize: 0.5,
acceptedFiles: 'image/png'
}
// Event handlerss3UploadError(errorMessage) {
console.error('error: ', errorMessage);
},s3UploadSuccess(s3ObjectLocation) {
console.log('success: ', s3ObjectLocation);
},
What I saw on UI:
[image: UI]
<https://camo.githubusercontent.com/296301720ecf2e7d5c76068ef24deed6de5f242f/68747470733a2f2f692e696d6775722e636f6d2f6d65416b4d4a452e706e67>
Console log:
[image: Console]
<https://camo.githubusercontent.com/f2f5effe0a8a48137a5a7ab5bf2964647ab584a7/68747470733a2f2f692e696d6775722e636f6d2f63486b4b52654b2e706e67>
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#300>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AME1nYeqljDugWrTbTHJSTK14-BCfufXks5tcCZLgaJpZM4Sg774>
.
|
Sorry I realized I didn't phrase my question clearly. I actually uploaded a file that has a non-accepted extension so I was expecting to see the error (which is correct on the UI) and the file shouldn't have been sent successfully to S3 (but it was). |
FWIW, the same issue applies to max size allowed config option too (i.e. if I try to upload a file that's larger than the allowed size, it'll be shown as an error on the UI. However the file is still actually uploaded to S3). Also if I don't use the provided S3 direct upload functionality (i.e. do not use the |
Thanks for reporting this. We will look into this. +1 |
same thing happens with the accept method for example:
as per the docs, if I try to upload a file called 'large.png' it should reject the upload. I confirm that it does go inside the method and does go into the if that should reject the upload, however it has no impact and the file is uploaded anyway I suspect this is also why the renameFile method does nothing as well when uploading to S3 |
I'm also hitting this issue. I have a workaround that seems to work until this is fixed properly. Add a handler for the vdropzone-sending event:
In that function, check if the file is accepted. If it's not, cancel the request to S3. sending: function(file) {
if (!file.accepted) {
// abort doesn't work. Setting the timeout is the only thing I've found that cancels the s3 request.
file.xhr.timeout = 1;
}
} |
@vrajroham Any progress on this? |
Hey, @vinayakkulkarni not yet honestly! Will be fixing this soon and will update here. |
The issue is in the vue-dropzone.vue component file on line 415 at the end of a conditional in the getSignedAndUploadToS3 method. } else {
promise.then(() => {
setTimeout(() => this.dropzone.processFile(file));
});
} The processFile function called and doesn't check file.accepted status. Error status files are processed as normal. } else {
promise.then(() => {
if(file.status != Dropzone.QUEUED) return
setTimeout(() => this.dropzone.processFile(file));
});
} |
@vrajroham This is definitely still an issue with a simple fix. Would love to get a PR merged with @ganicus proposed code change! |
Seams like this is still an issue. Can anyone else confirm? |
Resolved in #549 |
I'm following the example for S3 direct upload, and I've also specified
acceptedFiles
in the dropzoneOptions config object. I can see the uploaded file shown as an error, however it actually was still uploaded successfully on to my S3 bucket. Here's my code:What I saw on UI:
Console log:
The text was updated successfully, but these errors were encountered: