mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: trim filename spaces
This commit is contained in:
2 files changed
+3
No files matched your search
@@ -239,6 +239,7 @@ export class ProblemModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static async addTestdata(domainId: string, pid: number, name: string, f: Readable | Buffer | string, operator = 1) {
|
static async addTestdata(domainId: string, pid: number, name: string, f: Readable | Buffer | string, operator = 1) {
|
||||||
|
name = name.trim();
|
||||||
if (!name) throw new ValidationError('name');
|
if (!name) throw new ValidationError('name');
|
||||||
const [[, fileinfo]] = await Promise.all([
|
const [[, fileinfo]] = await Promise.all([
|
||||||
document.getSub(domainId, document.TYPE_PROBLEM, pid, 'data', name),
|
document.getSub(domainId, document.TYPE_PROBLEM, pid, 'data', name),
|
||||||
@@ -266,6 +267,7 @@ export class ProblemModel {
|
|||||||
domainId: string, pid: number, name: string,
|
domainId: string, pid: number, name: string,
|
||||||
f: Readable | Buffer | string, operator = 1, skipUpload = false,
|
f: Readable | Buffer | string, operator = 1, skipUpload = false,
|
||||||
) {
|
) {
|
||||||
|
name = name.trim();
|
||||||
const [[, fileinfo]] = await Promise.all([
|
const [[, fileinfo]] = await Promise.all([
|
||||||
document.getSub(domainId, document.TYPE_PROBLEM, pid, 'additional_file', name),
|
document.getSub(domainId, document.TYPE_PROBLEM, pid, 'additional_file', name),
|
||||||
skipUpload ? '' : storage.put(`problem/${domainId}/${pid}/additional_file/${name}`, f, operator),
|
skipUpload ? '' : storage.put(`problem/${domainId}/${pid}/additional_file/${name}`, f, operator),
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ export { Collections } from './service/db';
|
|||||||
// export { Collections } from './interface';
|
// export { Collections } from './interface';
|
||||||
export { Service, Context } from './context';
|
export { Service, Context } from './context';
|
||||||
export { buildContent } from './lib/content';
|
export { buildContent } from './lib/content';
|
||||||
|
export { default as rating } from './lib/rating';
|
||||||
export { default as avatar } from './lib/avatar';
|
export { default as avatar } from './lib/avatar';
|
||||||
export { default as rank } from './lib/rank';
|
export { default as rank } from './lib/rank';
|
||||||
export { default as paginate } from './lib/paginate';
|
export { default as paginate } from './lib/paginate';
|
||||||
|
|||||||
Reference in new issue
Block a user