Feat: add filename check

This commit is contained in:
unitwk 2023-01-16 19:13:36 +08:00
parent dba205eefb
commit cc733311ce

View File

@ -110,6 +110,8 @@ export default class FileManager {
}
async newFile(fileName: string) {
if (!FileManager.checkFileName(fileName)) throw new Error(ERROR_MSG_01);
if (!this.checkPath(fileName)) throw new Error(ERROR_MSG_01);
const target = this.toAbsolutePath(fileName);
fs.createFile(target);
}