fix: corrige crash critico do express na rota de storage
This commit is contained in:
parent
9bb73d5a2b
commit
9d042e79ee
|
|
@ -52,10 +52,10 @@ const lockCache = new Set();
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// Proxy de Imagens do MinIO (acesso público via backend)
|
// Proxy de Imagens do MinIO (acesso público via backend)
|
||||||
// ============================================================
|
// ============================================================
|
||||||
app.get('/storage/:bucket/*', async (req, res) => {
|
app.get(/^\/storage\/([^\/]+)\/(.+)$/, async (req, res) => {
|
||||||
try {
|
try {
|
||||||
const bucket = req.params.bucket;
|
const bucket = req.params[0];
|
||||||
const key = req.params[0]; // Captura tudo que vem após o bucket (incluindo barras)
|
const key = req.params[1]; // Captura tudo que vem após o bucket (incluindo barras)
|
||||||
|
|
||||||
const command = new GetObjectCommand({ Bucket: bucket, Key: key });
|
const command = new GetObjectCommand({ Bucket: bucket, Key: key });
|
||||||
const data = await s3Client.send(command);
|
const data = await s3Client.send(command);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue