fix: old version get stream (#825)

Co-authored-by: sealday <sealday@gmail.com>
Reviewed-on: daoyoucloud/tachybase#825
This commit is contained in:
sealday 2024-04-24 02:58:22 +08:00
parent 737360bbcb
commit 58a799aea4
2 changed files with 8 additions and 2 deletions

View File

@ -0,0 +1,5 @@
---
"@hera/plugin-rental": patch
---
fix get-stream

View File

@ -8,7 +8,7 @@ import _ from 'lodash';
import { FilterParser, Repository } from '@nocobase/database'; import { FilterParser, Repository } from '@nocobase/database';
import { CollectionRepository } from '@nocobase/plugin-collection-manager'; import { CollectionRepository } from '@nocobase/plugin-collection-manager';
import { Cache } from '@nocobase/cache'; import { Cache } from '@nocobase/cache';
import { getStreamAsBuffer } from 'get-stream'; import getStream from 'get-stream';
import { stringify } from 'flatted'; import { stringify } from 'flatted';
@Controller('records') @Controller('records')
@ -237,7 +237,8 @@ export class RecordPreviewController {
ctx.body = Buffer.from(result.data); ctx.body = Buffer.from(result.data);
} }
} else { } else {
const buf = await getStreamAsBuffer( const buf = await getStream.buffer(
// @ts-ignore
await this.recordPdfService.transformPdfV2(record, leaseData, feeData, { isDouble: double, printSetup }), await this.recordPdfService.transformPdfV2(record, leaseData, feeData, { isDouble: double, printSetup }),
); );
ctx.body = buf; ctx.body = buf;