mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
replace String.random with randomstring
This commit is contained in:
22 files changed
+64
-48
No files matched your search
@@ -4,7 +4,7 @@ import path from 'path';
|
||||
import { Readable } from 'stream';
|
||||
import {
|
||||
buildContent, Context, extractZip, FileTooLargeError, fs, Handler, PERM,
|
||||
ProblemConfigFile, ProblemModel, Schema, ValidationError, yaml, Zip,
|
||||
ProblemConfigFile, ProblemModel, randomstring, Schema, ValidationError, yaml, Zip,
|
||||
} from 'hydrooj';
|
||||
|
||||
const tmpdir = path.join(os.tmpdir(), 'hydro', 'import-qduoj');
|
||||
@@ -49,7 +49,7 @@ const ProblemSchema = Schema.object({
|
||||
class ImportQduojHandler extends Handler {
|
||||
async fromFile(domainId: string, zipfile: string) {
|
||||
const zip = new Zip.ZipReader(Readable.toWeb(fs.createReadStream(zipfile)));
|
||||
const tmp = path.resolve(tmpdir, String.random(32));
|
||||
const tmp = path.resolve(tmpdir, randomstring(32));
|
||||
await extractZip(zip, tmp, {
|
||||
strip: true,
|
||||
parseError: (e) => new ValidationError('zip', null, e.message),
|
||||
|
||||
Reference in new issue
Block a user