Fix: range request header on response
All checks were successful
Build and push image / release-image (push) Successful in 1m34s

This commit is contained in:
2025-07-10 17:12:33 +08:00
parent 8b66e589d7
commit 6ab755d91a
2 changed files with 22 additions and 15 deletions

View File

@@ -30,22 +30,16 @@ export class AppService {
return 'OK';
}
async getObject(getObjectConfig: GetObjectCommandInput): Promise<Readable | null> {
async getObject(
getObjectConfig: GetObjectCommandInput,
): Promise<GetObjectCommandOutput | null> {
const command = new GetObjectCommand(getObjectConfig);
let res: GetObjectCommandOutput;
try {
res = await this.s3Client.send(command);
return await this.s3Client.send(command);
} catch (err: unknown) {
if (err instanceof NoSuchKey)
return null;
throw err;
}
if (!res.Body)
throw new HttpException(
's3 get object failed',
HttpStatus.INTERNAL_SERVER_ERROR,
);
return res.Body as Readable;
}
}