fix(media): update S3 file info type casting for stricter type safety
Replace `any` with `BucketItemStat` for `getFileInfo` response in MediaController to ensure accurate type definition.
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import { Controller, Get, NotFoundException, Param, Res } from "@nestjs/common";
|
import { Controller, Get, NotFoundException, Param, Res } from "@nestjs/common";
|
||||||
import type { Response } from "express";
|
import type { Response } from "express";
|
||||||
|
import type { BucketItemStat } from "minio";
|
||||||
import { S3Service } from "../s3/s3.service";
|
import { S3Service } from "../s3/s3.service";
|
||||||
|
|
||||||
@Controller("media")
|
@Controller("media")
|
||||||
@@ -9,7 +10,7 @@ export class MediaController {
|
|||||||
@Get("*key")
|
@Get("*key")
|
||||||
async getFile(@Param("key") key: string, @Res() res: Response) {
|
async getFile(@Param("key") key: string, @Res() res: Response) {
|
||||||
try {
|
try {
|
||||||
const stats = (await this.s3Service.getFileInfo(key)) as any;
|
const stats = (await this.s3Service.getFileInfo(key)) as BucketItemStat;
|
||||||
const stream = await this.s3Service.getFile(key);
|
const stream = await this.s3Service.getFile(key);
|
||||||
|
|
||||||
const contentType =
|
const contentType =
|
||||||
|
|||||||
Reference in New Issue
Block a user