feat: only return download url when not found

This commit is contained in:
Methapon2001 2024-08-14 17:41:00 +07:00
parent 5e74817f59
commit 0f3fc7171b
No known key found for this signature in database
GPG key ID: 849924FEF46BD132

View file

@ -823,7 +823,9 @@ export class StorageController extends Controller {
});
if (search && search.hits.hits.length === 0) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบไฟล์");
return {
downloadUrl: await minioClient.presignedGetObject(DEFAULT_BUCKET, pathname),
};
}
const { attachment, ...rest } = search.hits.hits[0]._source!;