bug fixed
This commit is contained in:
parent
55170ae702
commit
4debdf1ec9
|
@ -228,9 +228,18 @@ export class CommonApiService {
|
||||||
): Promise<{ accept: boolean; rejected: string[] }> {
|
): Promise<{ accept: boolean; rejected: string[] }> {
|
||||||
return new Promise<{ accept: boolean; rejected: string[] }>(
|
return new Promise<{ accept: boolean; rejected: string[] }>(
|
||||||
async (resolve, reject) => {
|
async (resolve, reject) => {
|
||||||
|
const mediaFiles = this.mediaFiles(files);
|
||||||
|
if (!mediaFiles) {
|
||||||
|
resolve({
|
||||||
|
accept: true,
|
||||||
|
rejected: undefined
|
||||||
|
});
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
let accept = true;
|
let accept = true;
|
||||||
const rejected: string[] = [];
|
const rejected: string[] = [];
|
||||||
for (const file of files) {
|
for (const file of mediaFiles) {
|
||||||
const info = await MimeUtil.getMimeFromBlob(file);
|
const info = await MimeUtil.getMimeFromBlob(file);
|
||||||
// console.log('mime info', info);
|
// console.log('mime info', info);
|
||||||
if (
|
if (
|
||||||
|
|
|
@ -1140,41 +1140,35 @@ export class MessagesComponent implements OnInit, OnDestroy, AfterViewInit {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const mediaFiles = this.commonApiService.mediaFiles(
|
const fakeMedia = await this.commonApiService.checkInvalidMediaMimeForFileTalk(
|
||||||
fileUploadItems.map(fui => fui.file)
|
fileUploadItems.map(fui => fui.file)
|
||||||
);
|
);
|
||||||
|
if (!fakeMedia.accept) {
|
||||||
if (!!mediaFiles) {
|
if (!!this.fileUploadQueue) {
|
||||||
const fakeMedia = await this.commonApiService.checkInvalidMediaMimeForFileTalk(
|
this.fileUploadQueue.onUploadComplete();
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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) {
|
for (const fileUploadItem of fileUploadItems) {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user