Skip to content

Commit

Permalink
fix: preview - fileMessage
Browse files Browse the repository at this point in the history
  • Loading branch information
jrCleber committed Oct 25, 2024
1 parent 854a3a6 commit 2648a65
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/whatsapp/services/whatsapp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1411,7 +1411,7 @@ export class WAStartupService {
}

if (mediaMessage.mediatype === 'image') {
const p = await sharp(preview)
const p = await sharp(preview || media)
.resize(320, 240, { fit: 'contain' })
.toFormat('jpeg', { quality: 80 })
.toBuffer();
Expand All @@ -1426,13 +1426,14 @@ export class WAStartupService {
);
} catch (error) {
const axiosError = error as AxiosError;
this.logger.error(axiosError?.message);

if (axiosError?.isAxiosError) {
this.logger.error(axiosError?.message);
const err = Buffer.from(axiosError?.response?.data as any).toString('utf-8');
throw new BadRequestException(axiosError?.message, err);
}

this.logger.error(error);

throw new InternalServerErrorException(error?.toString() || error);
}
}
Expand Down

0 comments on commit 2648a65

Please sign in to comment.