How to use the yauzl.validateFileName function in yauzl

To help you get started, we’ve selected a few yauzl examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / app-metadata / src / contentBase.ts View on Github external
private validateAndDecodeFilename(fileList: string[], entry: any) : string {
        let validName = entry.fileName.toString().split('\\').join(path.sep);
        validName = decodeURI(validName);
        const errorMessage = yauzl.validateFileName(validName);
        if (errorMessage != null) {
            throw new ExtractError("unzip filename validation failed");
        }
        fileList.push(validName);
        return validName;
    }
}