fix: t-005 a t-0029 correctif
This commit is contained in:
@@ -3,13 +3,11 @@ import {
|
||||
shellQuote,
|
||||
resolveFolderRemoteDir,
|
||||
REMOTE_HOST,
|
||||
isSafeFolder,
|
||||
isSafeFile
|
||||
} from "../utils/ssh.ts"
|
||||
import { spawn } from "node:child_process"
|
||||
|
||||
const isSafeFolder = (value: string) => /^[a-zA-Z0-9._-]+$/.test(value)
|
||||
const isSafeFile = (value: string) => /^[a-zA-Z0-9._-]+$/.test(value)
|
||||
|
||||
|
||||
function buildContentDisposition(fileName: string) {
|
||||
const asciiName = fileName.replace(/[^\x20-\x7E]/g, "_").replace(/["\\]/g, "_")
|
||||
return `attachment; filename="${asciiName}"; filename*=UTF-8''${encodeURIComponent(fileName)}`
|
||||
@@ -61,6 +59,6 @@ export default defineEventHandler(async (event) => {
|
||||
console.error(`Erreur téléchargement SSH (${code}): ${stderr}`)
|
||||
}
|
||||
})
|
||||
|
||||
event.node.res.on("close", () => child.kill())
|
||||
return sendStream(event, child.stdout)
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user