浏览代码

save test 404

master
leiyun 10 个月前
父节点
当前提交
034e2cdb4b
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. +5
    -4
      src/home/controller/index.js

+ 5
- 4
src/home/controller/index.js 查看文件

@@ -302,15 +302,16 @@ export default class extends Base {
let params = this.param();
let file = params.file;
console.log('file:--------------->', file);
if (!file || file.includes('test-') == -1) {
return this.fail('文件名错误');
}
// if (!file || file.includes('test-') == -1) {
// return this.fail('文件名错误');
// }
try {
let txt = fs.readFileSync(path.join(LECHALLENGE_PATH, params.file))
this.json(txt);
} catch (e) {
console.log('文件名错误', e);
return this.fail('文件名错误');
this.status(404);
return this.json("");
}
}
}

正在加载...
取消
保存