fake image 쪽지쪽 처리.
This commit is contained in:
parent
f113e66377
commit
d6b518f29b
|
@ -178,6 +178,10 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
return;
|
||||
}
|
||||
|
||||
this.validUploadFile(fileList).then(async result => {
|
||||
if (!result) {
|
||||
return;
|
||||
} else {
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
const file = fileList.item(i);
|
||||
|
||||
|
@ -198,6 +202,8 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
|
||||
self.checkContentLength();
|
||||
self.changeDetectorRef.detectChanges();
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -228,7 +234,7 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
};
|
||||
}
|
||||
|
||||
validUploadFile(fileList: FileList): boolean {
|
||||
async validUploadFile(fileList: FileList): Promise<boolean> {
|
||||
let valid = true;
|
||||
if (this.fileAllowSize > 0) {
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
|
@ -284,6 +290,39 @@ export class WriteComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
return valid;
|
||||
}
|
||||
|
||||
const files: File[] = [];
|
||||
for (let i = 0; i < fileList.length; i++) {
|
||||
files.push(fileList.item(i));
|
||||
}
|
||||
const fakeMedia = await this.commonApiService.checkInvalidMediaMimeForFileTalk(
|
||||
files
|
||||
);
|
||||
if (!fakeMedia.accept) {
|
||||
this.ngZone.run(() => {
|
||||
this.snackBarService.openFromComponent<
|
||||
AlertSnackbarComponent,
|
||||
AlertSnackbarData
|
||||
>(AlertSnackbarComponent, {
|
||||
duration: 1000,
|
||||
verticalPosition: 'bottom',
|
||||
horizontalPosition: 'center',
|
||||
data: {
|
||||
html: this.translateService.instant(
|
||||
'common.file.errors.notAcceptableMime',
|
||||
{
|
||||
supporedType:
|
||||
fakeMedia.rejected.length > 0
|
||||
? fakeMedia.rejected.join(',')
|
||||
: ''
|
||||
}
|
||||
)
|
||||
}
|
||||
});
|
||||
});
|
||||
valid = false;
|
||||
return valid;
|
||||
}
|
||||
|
||||
return valid;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user