Browse Source

Execute `dos2unix` on testdata after upload to fix CRLF problem

pull/6/head
Menci 6 years ago
parent
commit
41bd1bdc7a
  1. 4
      models/problem.js

4
models/problem.js

@ -369,6 +369,10 @@ class Problem extends Model {
if (!noLimit && oldCount + !replace > syzoj.config.limit.testdata_filecount) throw new ErrorMessage('数据包中的文件太多。'); if (!noLimit && oldCount + !replace > syzoj.config.limit.testdata_filecount) throw new ErrorMessage('数据包中的文件太多。');
await fs.move(filepath, path.join(dir, filename), { overwrite: true }); await fs.move(filepath, path.join(dir, filename), { overwrite: true });
let execFileAsync = Promise.promisify(require('child_process').execFile);
try { await execFileAsync('dos2unix', [path.join(dir, filename)]); } catch (e) {}
await fs.remove(this.getTestdataArchivePath()); await fs.remove(this.getTestdataArchivePath());
}); });
} }

Loading…
Cancel
Save