11import { Component , EventEmitter , Input , OnInit , Output } from '@angular/core' ;
22import { FormBuilder , FormControl , FormGroup , Validators } from '@angular/forms' ;
3+ import { DomSanitizer , SafeUrl } from '@angular/platform-browser' ;
34import {
45 CreateArchiveFileValue ,
56 CreateAudioFileValue ,
@@ -38,7 +39,7 @@ export class UploadComponent implements OnInit {
3839 form : FormGroup ;
3940 fileControl : FormControl ;
4041 isLoading = false ;
41- thumbnailUrl : string ;
42+ thumbnailUrl : string | SafeUrl ;
4243
4344 allowedFileTypes : string [ ] ;
4445 // todo: maybe we can use this list to display which file format is allowed to
@@ -47,13 +48,10 @@ export class UploadComponent implements OnInit {
4748 supportedAudioTypes = [ 'audio/mpeg' ] ;
4849 supportedArchiveTypes = [ 'application/zip' , 'application/x-tar' , 'application/gzip' ] ;
4950
50- // readonly fromLabels = {
51- // upload: 'Upload file',
52- // drag_drop: 'Drag and drop or click to upload'
53- // };
5451 constructor (
5552 private _fb : FormBuilder ,
5653 private _notification : NotificationService ,
54+ private _sanitizer : DomSanitizer ,
5755 private _upload : UploadFileService
5856 ) { }
5957
@@ -97,7 +95,7 @@ export class UploadComponent implements OnInit {
9795 case 'stillImage' :
9896 const temporaryUrl = res . uploadedFiles [ 0 ] . temporaryUrl ;
9997 const thumbnailUri = '/full/256,/0/default.jpg' ;
100- this . thumbnailUrl = ` ${ temporaryUrl } ${ thumbnailUri } ` ;
98+ this . thumbnailUrl = this . _sanitizer . bypassSecurityTrustUrl ( temporaryUrl + thumbnailUri ) ;
10199 break ;
102100
103101 case 'document' :
0 commit comments