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

UPLOADER_EVENTS.REQUEST_PRE_SEND: items array has undefined value #232

Closed
creage opened this issue Sep 8, 2021 · 2 comments
Closed

UPLOADER_EVENTS.REQUEST_PRE_SEND: items array has undefined value #232

creage opened this issue Sep 8, 2021 · 2 comments
Labels
bug Something isn't working

Comments

@creage
Copy link

creage commented Sep 8, 2021

Describe the bug
After upgrading to the 0.13.3 the items argument for UPLOADER_EVENTS.REQUEST_PRE_SEND listener has undefined instead of the File I'm trying to upload. It works on 0.13.2.

To Reproduce
Steps to reproduce the behavior:

  1. Try to drop a file from your file system

Expected behavior
File should start to upload with proper headers in its request.

Versions
Chrome - version 0.13.2 works, 0.13.3 fails.

Code

const listeners = useMemo(() => ({

  [UPLOADER_EVENTS.REQUEST_PRE_SEND]: async (request: any) => {
  
    const { items } = request;
    
    const fileName = items[0].file.name, // <-- BUG: items[0] is undefined
          slug = `${uuid()}_${fileName}`;
    
    const headers = {
      slug,
      'content-disposition': `attachment;filename="${fileName}"`
    };
    
    return {
      options: {
        destination: {
          headers
        }
      }
    };
  }
}), []);
@yoavniran
Copy link
Collaborator

thanks @creage definitely seems like a bug.
Curious how none of the automation tests caught this... :(
Will fix soon

@yoavniran yoavniran added the bug Something isn't working label Sep 8, 2021
@yoavniran
Copy link
Collaborator

@creage 0.13.4 is available and should fix the problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants