replace String.random with randomstring

This commit is contained in:
undefined committed 2025-06-30 16:24:35 +08:00
1 parent b18cce3f66
commit 5d7f5fef38
22 files changed
+64 -48

No files matched your search

+2 -2
View File
@@ -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),