diff --git a/lib/process-services/content-widget/attach-file-widget.component.ts b/lib/process-services/content-widget/attach-file-widget.component.ts index a45623ec3f..3cf186bf61 100644 --- a/lib/process-services/content-widget/attach-file-widget.component.ts +++ b/lib/process-services/content-widget/attach-file-widget.component.ts @@ -31,7 +31,7 @@ import { AppConfigService } from '@alfresco/adf-core'; import { ContentNodeDialogService } from '@alfresco/adf-content-services'; -import { Node } from '@alfresco/js-api'; +import { Node, RelatedContentRepresentation } from '@alfresco/js-api'; import { from, zip, of } from 'rxjs'; import { mergeMap } from 'rxjs/operators'; import { AttachFileWidgetDialogService } from './attach-file-widget-dialog.service'; @@ -147,9 +147,9 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements this.onFileChanged(event); } - onRemoveAttachFile(file: any) { + onRemoveAttachFile(file: File | RelatedContentRepresentation) { if (this.isTemporaryFile(file)) { - this.tempFilesList.splice(this.tempFilesList.indexOf(file.contentBlob), 1); + this.tempFilesList.splice(this.tempFilesList.indexOf(( file).contentBlob), 1); } this.removeFile(file); } @@ -166,13 +166,13 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements } } - downloadContent(file: any): void { + downloadContent(file: any | RelatedContentRepresentation): void { if (this.isTemporaryFile(file)) { - this.contentService.downloadBlob(file, file.name); + this.contentService.downloadBlob(( file).contentBlob, file.name); } else { - this.processContentService.getFileRawContent(file.id).subscribe( + this.processContentService.getFileRawContent(( file).id).subscribe( (blob: Blob) => { - this.contentService.downloadBlob(blob, file.name); + this.contentService.downloadBlob(blob, ( file).name); }, (err) => { this.logger.error('Impossible retrieve content for download'); @@ -213,19 +213,19 @@ export class AttachFileWidgetComponent extends UploadWidgetComponent implements ) ) ) - .subscribe(([mimeType, res, isExternal]) => { - res.mimeType = mimeType; - res.isExternal = isExternal; - filesSaved.push(res); - }, - (error) => { - this.logger.error(error); - }, - () => { - this.field.value = filesSaved; - this.field.json.value = filesSaved; - this.hasFile = true; - }); + .subscribe(([mimeType, res, isExternal]) => { + res.mimeType = mimeType; + res.isExternal = isExternal; + filesSaved.push(res); + }, + (error) => { + this.logger.error(error); + }, + () => { + this.field.value = filesSaved; + this.field.json.value = filesSaved; + this.hasFile = true; + }); } private getDomainHost(urlToCheck) {