X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Fhelpers%2Fcustom-validators%2Fmisc.ts;h=ebab4c6b244ba1277a0424c089e535fd9faac131;hb=d7ce9dca613d96889baa0c93063806268f68cce5;hp=b3ab3ac64704edda06955c18d384df3b2e044017;hpb=4765348107ddd21cd2a0b86093859aa2e23ac0f1;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts index b3ab3ac64..ebab4c6b2 100644 --- a/server/helpers/custom-validators/misc.ts +++ b/server/helpers/custom-validators/misc.ts @@ -15,6 +15,10 @@ function isSafePath (p: string) { }) } +function isSafePeerTubeFilenameWithoutExtension (filename: string) { + return filename.match(/^[a-z0-9-]+$/) +} + function isArray (value: any): value is any[] { return Array.isArray(value) } @@ -172,5 +176,6 @@ export { areUUIDsValid, toIntArray, isFileValid, + isSafePeerTubeFilenameWithoutExtension, checkMimetypeRegex }