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

Missing observable boolean checking [nzBeforeUpload] #2167

Closed
KhaledSMQ opened this issue Sep 19, 2018 · 1 comment
Closed

Missing observable boolean checking [nzBeforeUpload] #2167

KhaledSMQ opened this issue Sep 19, 2018 · 1 comment

Comments

@KhaledSMQ
Copy link

KhaledSMQ commented Sep 19, 2018

Version

1.5.0

Environment

Angular 6

Reproduction link

https://ng-zorro-antd-start-2cy3cn.stackblitz.io
https://stackblitz.com/edit/ng-zorro-antd-start-2cy3cn

Steps to reproduce

problems comes when i am return observable and i want to cancel by returning switchMap or for any condition or return false or null upload process continue, means returning observable acutely it's not doing any thing only to keep upload async.

What is expected?

the return type must be valid otherwise will not process uploading the file.

What is actually happening?

I think this part is missing to check boolean returned from observable as per the documentation i can return boolean or observable

if (processedFileType === '[object File]' || processedFileType === '[object Blob]') {

here my suggestion fix for this issue.

        before.subscribe((processedFile: UploadFile | boolean ) => {
             const processedFileType = Object.prototype.toString.call(processedFile);
        if (processedFileType === '[object File]' || processedFileType === '[object Blob]') {
          this.attachUid(processedFile as UploadFile );
          this.post(processedFile as UploadFile);
     
        } else  if (processedFileType === '[object Boolean]'  && processedFile !== false) {
          this.post(file);
        } 
 

Other?

@lock
Copy link

lock bot commented Sep 21, 2019

This thread has been automatically locked because it has not had recent activity. Please open a new issue for related bugs and link to relevant comments in this thread.

@lock lock bot locked as resolved and limited conversation to collaborators Sep 21, 2019
hsuanxyz pushed a commit to hsuanxyz/ng-zorro-antd that referenced this issue Aug 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants