core: cross-domain file id

This commit is contained in:
undefined committed 2021-10-26 15:08:05 +08:00
1 parent a988445597
commit bf4d0d6fdd
4 files changed
+6 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.1.6",
"version": "3.1.7",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+2 -1
View File
@@ -444,6 +444,7 @@ export class ProblemFilesHandler extends ProblemDetailHandler {
if (type === 'testdata' && !this.user.own(this.pdoc)) {
if (!this.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
}
if (this.pdoc.reference) this.pdoc = await problem.get(this.pdoc.reference.domainId, this.pdoc.reference.pid);
const links = {};
for (const file of files) {
// eslint-disable-next-line no-await-in-loop
@@ -536,7 +537,7 @@ export class ProblemFileDownloadHandler extends ProblemDetailHandler {
if (type === 'testdata' && !this.user.own(this.pdoc)) {
if (!this.user.hasPriv(PRIV.PRIV_READ_PROBLEM_DATA)) this.checkPerm(PERM.PERM_READ_PROBLEM_DATA);
}
const target = `problem/${domainId}/${this.pdoc.docId}/${type}/${filename}`;
const target = `problem/${this.pdoc.domainId}/${this.pdoc.docId}/${type}/${filename}`;
const file = await storage.getMeta(target);
if (!file) {
this.response.redirect = await storage.signDownloadLink(
+3 -1
View File
@@ -245,7 +245,9 @@ const oi: ContestRule = {
for (const pid of tdoc.pids) {
const index = `${tsdoc.uid}/${tdoc.domainId}/${pid}`;
// eslint-disable-next-line @typescript-eslint/no-use-before-define
const node: ScoreboardNode = (!isExport && isDone(tdoc) && tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString())
const node: ScoreboardNode = (!isExport && isDone(tdoc)
&& psdict[index]?.rid
&& tsddict[pid]?.rid?.toHexString() !== psdict[index]?.rid?.toHexString())
? {
type: 'records',
value: '',
-1
View File
@@ -311,7 +311,6 @@ async function discussionNode(src: Db, report: Function) {
function addSpace(content: string) {
const lines = content.split('\r\n');
for (let i = 0; i < lines.length; i++) {
// eslint-disable-next-line no-continue
if (lines[i].endsWith('|')) continue; // Markdown table;
if (!lines[i].endsWith(' ')) lines[i] = `${lines[i]} `;
}