summaryrefslogtreecommitdiff
path: root/packages/backend/src/server/api/endpoints/admin/drive
diff options
context:
space:
mode:
authorJohann150 <johann.galle@protonmail.com>2022-04-03 06:57:26 +0200
committerGitHub <noreply@github.com>2022-04-03 13:57:26 +0900
commitc8935b32f889165782844a709c79df4325bbee58 (patch)
tree5c66ec8bb485ec117eff2b2a82b0731deafdae87 /packages/backend/src/server/api/endpoints/admin/drive
parentUpdate CHANGELOG.md (diff)
downloadmisskey-c8935b32f889165782844a709c79df4325bbee58.tar.gz
misskey-c8935b32f889165782844a709c79df4325bbee58.tar.bz2
misskey-c8935b32f889165782844a709c79df4325bbee58.zip
fix: validation (better #8456) (#8461)
* Revert "revert 484e023c0" This reverts commit c03b70c949923b830a6d0361d1aa4d5f5614b7b7. * also allow pure renote * fix checks for pure renote
Diffstat (limited to 'packages/backend/src/server/api/endpoints/admin/drive')
-rw-r--r--packages/backend/src/server/api/endpoints/admin/drive/files.ts7
-rw-r--r--packages/backend/src/server/api/endpoints/admin/drive/show-file.ts20
2 files changed, 21 insertions, 6 deletions
diff --git a/packages/backend/src/server/api/endpoints/admin/drive/files.ts b/packages/backend/src/server/api/endpoints/admin/drive/files.ts
index 646d85a1e0..119c4db19b 100644
--- a/packages/backend/src/server/api/endpoints/admin/drive/files.ts
+++ b/packages/backend/src/server/api/endpoints/admin/drive/files.ts
@@ -27,7 +27,12 @@ export const paramDef = {
untilId: { type: 'string', format: 'misskey:id' },
type: { type: 'string', nullable: true, pattern: /^[a-zA-Z0-9\/\-*]+$/.toString().slice(1, -1) },
origin: { type: 'string', enum: ['combined', 'local', 'remote'], default: "local" },
- hostname: { type: 'string', nullable: true, default: null },
+ hostname: {
+ type: 'string',
+ nullable: true,
+ default: null,
+ description: 'The local host is represented with `null`.',
+ },
},
required: [],
} as const;
diff --git a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts
index 4b27fc0188..039df74f1b 100644
--- a/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts
+++ b/packages/backend/src/server/api/endpoints/admin/drive/show-file.ts
@@ -40,6 +40,7 @@ export const meta = {
userHost: {
type: 'string',
optional: false, nullable: true,
+ description: 'The local host is represented with `null`.',
},
md5: {
type: 'string',
@@ -151,11 +152,20 @@ export const meta = {
export const paramDef = {
type: 'object',
- properties: {
- fileId: { type: 'string', format: 'misskey:id' },
- url: { type: 'string' },
- },
- required: [],
+ anyOf: [
+ {
+ properties: {
+ fileId: { type: 'string', format: 'misskey:id' },
+ },
+ required: ['fileId'],
+ },
+ {
+ properties: {
+ url: { type: 'string' },
+ },
+ required: ['url'],
+ },
+ ],
} as const;
// eslint-disable-next-line import/no-default-export