aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/client-html.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-06-28 17:30:59 +0200
committerChocobozzz <chocobozzz@cpy.re>2021-06-29 14:56:35 +0200
commitd4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb (patch)
treea4cb07318100031951c3dffc61f4f2cb95d2cbd0 /server/lib/client-html.ts
parent62ddc31a9e4b92d7d27898ccfc363f68ab044139 (diff)
downloadPeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.gz
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.tar.zst
PeerTube-d4a8e7a65f97bb3257facc13e1ae8ffdbad61ddb.zip
Support short uuid for GET video/playlist
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r--server/lib/client-html.ts9
1 files changed, 7 insertions, 2 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts
index 0191b55ef..72194416d 100644
--- a/server/lib/client-html.ts
+++ b/server/lib/client-html.ts
@@ -27,6 +27,7 @@ import { VideoChannelModel } from '../models/video/video-channel'
27import { VideoPlaylistModel } from '../models/video/video-playlist' 27import { VideoPlaylistModel } from '../models/video/video-playlist'
28import { MAccountActor, MChannelActor } from '../types/models' 28import { MAccountActor, MChannelActor } from '../types/models'
29import { ServerConfigManager } from './server-config-manager' 29import { ServerConfigManager } from './server-config-manager'
30import { toCompleteUUID } from '@server/helpers/custom-validators/misc'
30 31
31type Tags = { 32type Tags = {
32 ogType: string 33 ogType: string
@@ -78,7 +79,9 @@ class ClientHtml {
78 return customHtml 79 return customHtml
79 } 80 }
80 81
81 static async getWatchHTMLPage (videoId: string, req: express.Request, res: express.Response) { 82 static async getWatchHTMLPage (videoIdArg: string, req: express.Request, res: express.Response) {
83 const videoId = toCompleteUUID(videoIdArg)
84
82 // Let Angular application handle errors 85 // Let Angular application handle errors
83 if (!validator.isInt(videoId) && !validator.isUUID(videoId, 4)) { 86 if (!validator.isInt(videoId) && !validator.isUUID(videoId, 4)) {
84 res.status(HttpStatusCode.NOT_FOUND_404) 87 res.status(HttpStatusCode.NOT_FOUND_404)
@@ -136,7 +139,9 @@ class ClientHtml {
136 return customHtml 139 return customHtml
137 } 140 }
138 141
139 static async getWatchPlaylistHTMLPage (videoPlaylistId: string, req: express.Request, res: express.Response) { 142 static async getWatchPlaylistHTMLPage (videoPlaylistIdArg: string, req: express.Request, res: express.Response) {
143 const videoPlaylistId = toCompleteUUID(videoPlaylistIdArg)
144
140 // Let Angular application handle errors 145 // Let Angular application handle errors
141 if (!validator.isInt(videoPlaylistId) && !validator.isUUID(videoPlaylistId, 4)) { 146 if (!validator.isInt(videoPlaylistId) && !validator.isUUID(videoPlaylistId, 4)) {
142 res.status(HttpStatusCode.NOT_FOUND_404) 147 res.status(HttpStatusCode.NOT_FOUND_404)