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 · 0 comments

Comments

Projects
None yet
3 participants
@KhaledSMQ

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment