fix: t-005 a t-0029 correctif

This commit is contained in:
2026-03-18 09:00:11 +01:00
parent bdb65a09ff
commit c12387ac94
16 changed files with 45 additions and 59 deletions

View File

@@ -3,11 +3,10 @@ import {
shellQuote,
resolveFolderRemoteDir,
REMOTE_HOST,
isSafeFolder
} from "../utils/ssh.ts"
import { spawn } from "node:child_process"
const isSafeFolder = (value: string) => /^[a-zA-Z0-9._-]+$/.test(value)
async function getLatestRemoteFile(remoteDir: string): Promise<string | null> {
const output = await runSsh(`cd ${shellQuote(remoteDir)} && ls -1A | sort -r | head -n 1`)
const fileName = output.trim()
@@ -45,6 +44,9 @@ export default defineEventHandler(async (event) => {
}
const fileName = await getLatestRemoteFile(remoteDir)
if (!fileName || !isSafeFolder(fileName)) {
continue
}
if (!fileName) {
continue
}
@@ -93,6 +95,6 @@ export default defineEventHandler(async (event) => {
console.error(`Erreur archive SSH (${code}): ${stderr}`)
}
})
event.node.res.on("close", () => child.kill())
return sendStream(event, child.stdout)
})