Browse Source

Fix download a testdata with no files causes zip the full syzoj dir

master
Menci 7 years ago
parent
commit
10cc70b547
  1. 5
      models/problem.js

5
models/problem.js

@ -374,8 +374,9 @@ class Problem extends Model {
let p7zip = new (require('node-7z'));
let list = await this.listTestdata(), path = require('path');
await p7zip.add(dir + '.zip', list.files.map(file => path.join(dir, file.filename)));
let list = await this.listTestdata(), path = require('path'), pathlist = list.files.map(file => path.join(dir, file.filename));
if (!pathlist.length) throw new ErrorMessage('无测试数据。');
await p7zip.add(dir + '.zip', pathlist);
});
}

Loading…
Cancel
Save