diff options
author | Chocobozzz <me@florianbigard.com> | 2023-07-12 10:53:46 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-07-12 10:56:07 +0200 |
commit | d959b763f089ed4c1087aa4aeb824a8ef6743111 (patch) | |
tree | f4b5e77757fde022c91e415906bcf4619f8ec31c /server/middlewares/validators/runners | |
parent | 88cde4392a27d5d37685a471f9bf83d537282c43 (diff) | |
download | PeerTube-d959b763f089ed4c1087aa4aeb824a8ef6743111.tar.gz PeerTube-d959b763f089ed4c1087aa4aeb824a8ef6743111.tar.zst PeerTube-d959b763f089ed4c1087aa4aeb824a8ef6743111.zip |
Avoid duplicate runner names
Diffstat (limited to 'server/middlewares/validators/runners')
-rw-r--r-- | server/middlewares/validators/runners/runners.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/server/middlewares/validators/runners/runners.ts b/server/middlewares/validators/runners/runners.ts index 71a1275d2..4d4d79b4c 100644 --- a/server/middlewares/validators/runners/runners.ts +++ b/server/middlewares/validators/runners/runners.ts | |||
@@ -35,6 +35,15 @@ const registerRunnerValidator = [ | |||
35 | }) | 35 | }) |
36 | } | 36 | } |
37 | 37 | ||
38 | const existing = await RunnerModel.loadByName(body.name) | ||
39 | if (existing) { | ||
40 | return res.fail({ | ||
41 | status: HttpStatusCode.BAD_REQUEST_400, | ||
42 | message: 'This runner name already exists on this instance', | ||
43 | tags | ||
44 | }) | ||
45 | } | ||
46 | |||
38 | res.locals.runnerRegistrationToken = runnerRegistrationToken | 47 | res.locals.runnerRegistrationToken = runnerRegistrationToken |
39 | 48 | ||
40 | return next() | 49 | return next() |