mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
import-qduoj: use os.tmpdir
This commit is contained in:
1 parent
627c46113f
commit
4d4098ee84
1 file changed
+3
-2
@@ -6,7 +6,8 @@ import {
|
||||
ProblemConfigFile, ProblemModel, ValidationError, yaml,
|
||||
} from 'hydrooj';
|
||||
|
||||
fs.ensureDirSync('/tmp/hydro/import-qduoj');
|
||||
const tmpdir = path.join(os.tmpdir(), 'hydro', 'import-qduoj');
|
||||
fs.ensureDirSync(tmpdir);
|
||||
|
||||
class ImportQduojHandler extends Handler {
|
||||
async fromFile(domainId: string, zipfile: string) {
|
||||
@@ -16,7 +17,7 @@ class ImportQduojHandler extends Handler {
|
||||
} catch (e) {
|
||||
throw new ValidationError('zip', null, e.message);
|
||||
}
|
||||
const tmp = path.resolve(os.tmpdir(), 'hydro', 'import-qduoj', String.random(32));
|
||||
const tmp = path.resolve(tmpdir, String.random(32));
|
||||
await new Promise((resolve, reject) => {
|
||||
zip.extractAllToAsync(tmp, true, (err) => (err ? reject(err) : resolve(null)));
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user