(baseDir, requestPath)
| 10 | const directoryPath = process.argv[2]||process.cwd(); |
| 11 | |
| 12 | function getSafeFilePath(baseDir, requestPath) { |
| 13 | const normalized = path.normalize(requestPath) |
| 14 | const fullPath = path.resolve(baseDir, './'+normalized); |
| 15 | // console.log("safe path",normalized,fullPath) |
| 16 | return fullPath.startsWith(baseDir + path.sep) || fullPath === baseDir?fullPath:null; |
| 17 | } |
| 18 | |
| 19 | const TYPE_MINE={ |
| 20 | '.html':'text/html', |