bug fixed
This commit is contained in:
parent
55170ae702
commit
4debdf1ec9
|
@ -228,9 +228,18 @@ export class CommonApiService {
|
|||
): Promise<{ accept: boolean; rejected: string[] }> {
|
||||
return new Promise<{ accept: boolean; rejected: string[] }>(
|
||||
async (resolve, reject) => {
|
||||
const mediaFiles = this.mediaFiles(files);
|
||||
if (!mediaFiles) {
|
||||
resolve({
|
||||
accept: true,
|
||||
rejected: undefined
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
let accept = true;
|
||||
const rejected: string[] = [];
|
||||
for (const file of files) {
|
||||
for (const file of mediaFiles) {
|
||||
const info = await MimeUtil.getMimeFromBlob(file);
|
||||
// console.log('mime info', info);
|
||||
if (
|
||||
|
|
|
@ -1140,41 +1140,35 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
|||
return;
|
||||
}
|
||||
|
||||
const mediaFiles = this.commonApiService.mediaFiles(
|
||||
const fakeMedia = await this.commonApiService.checkInvalidMediaMimeForFileTalk(
|
||||
fileUploadItems.map(fui => fui.file)
|
||||
);
|
||||
|
||||
if (!!mediaFiles) {
|
||||
const fakeMedia = await this.commonApiService.checkInvalidMediaMimeForFileTalk(
|
||||
mediaFiles
|
||||
);
|
||||
if (!fakeMedia.accept) {
|
||||
if (!!this.fileUploadQueue) {
|
||||
this.fileUploadQueue.onUploadComplete();
|
||||
}
|
||||
|
||||
this.snackBarService.openFromComponent<
|
||||
AlertSnackbarComponent,
|
||||
AlertSnackbarData
|
||||
>(AlertSnackbarComponent, {
|
||||
duration: 3000,
|
||||
verticalPosition: 'bottom',
|
||||
horizontalPosition: 'center',
|
||||
data: {
|
||||
html: this.translateService.instant(
|
||||
'common.file.errors.notAcceptableMime',
|
||||
{
|
||||
supporedType:
|
||||
fakeMedia.rejected.length > 0
|
||||
? fakeMedia.rejected.join(',')
|
||||
: ''
|
||||
}
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
if (!fakeMedia.accept) {
|
||||
if (!!this.fileUploadQueue) {
|
||||
this.fileUploadQueue.onUploadComplete();
|
||||
}
|
||||
|
||||
this.snackBarService.openFromComponent<
|
||||
AlertSnackbarComponent,
|
||||
AlertSnackbarData
|
||||
>(AlertSnackbarComponent, {
|
||||
duration: 3000,
|
||||
verticalPosition: 'bottom',
|
||||
horizontalPosition: 'center',
|
||||
data: {
|
||||
html: this.translateService.instant(
|
||||
'common.file.errors.notAcceptableMime',
|
||||
{
|
||||
supporedType:
|
||||
fakeMedia.rejected.length > 0
|
||||
? fakeMedia.rejected.join(',')
|
||||
: ''
|
||||
}
|
||||
)
|
||||
}
|
||||
});
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
for (const fileUploadItem of fileUploadItems) {
|
||||
|
|
Loading…
Reference in New Issue
Block a user