aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/custom-validators
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-12-28 14:42:48 +0100
committerChocobozzz <me@florianbigard.com>2022-12-28 14:42:48 +0100
commitded68a97600d70fb8bbadfbddac87eadb1233910 (patch)
tree263a5909c6cc491177d135b6f0eff2a38a6974cb /server/helpers/custom-validators
parent7a07da01c4009cf0697ec5cfa78e32b187b0e8b6 (diff)
downloadPeerTube-ded68a97600d70fb8bbadfbddac87eadb1233910.tar.gz
PeerTube-ded68a97600d70fb8bbadfbddac87eadb1233910.tar.zst
PeerTube-ded68a97600d70fb8bbadfbddac87eadb1233910.zip
More robust short to complete uuid error handler
Diffstat (limited to 'server/helpers/custom-validators')
-rw-r--r--server/helpers/custom-validators/misc.ts8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/helpers/custom-validators/misc.ts b/server/helpers/custom-validators/misc.ts
index 3dc5504e3..b3ab3ac64 100644
--- a/server/helpers/custom-validators/misc.ts
+++ b/server/helpers/custom-validators/misc.ts
@@ -103,7 +103,13 @@ function checkMimetypeRegex (fileMimeType: string, mimeTypeRegex: string) {
103// --------------------------------------------------------------------------- 103// ---------------------------------------------------------------------------
104 104
105function toCompleteUUID (value: string) { 105function toCompleteUUID (value: string) {
106 if (isShortUUID(value)) return shortToUUID(value) 106 if (isShortUUID(value)) {
107 try {
108 return shortToUUID(value)
109 } catch {
110 return null
111 }
112 }
107 113
108 return value 114 return value
109} 115}