diff options
Diffstat (limited to 'server/lib/client-html.ts')
-rw-r--r-- | server/lib/client-html.ts | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/server/lib/client-html.ts b/server/lib/client-html.ts index a69e09c32..fc013e0c3 100644 --- a/server/lib/client-html.ts +++ b/server/lib/client-html.ts | |||
@@ -8,6 +8,7 @@ import { VideoModel } from '../models/video/video' | |||
8 | import * as validator from 'validator' | 8 | import * as validator from 'validator' |
9 | import { VideoPrivacy } from '../../shared/models/videos' | 9 | import { VideoPrivacy } from '../../shared/models/videos' |
10 | import { readFile } from 'fs-extra' | 10 | import { readFile } from 'fs-extra' |
11 | import { getActivityStreamDuration } from '../models/video/video-format-utils' | ||
11 | 12 | ||
12 | export class ClientHtml { | 13 | export class ClientHtml { |
13 | 14 | ||
@@ -38,10 +39,8 @@ export class ClientHtml { | |||
38 | let videoPromise: Bluebird<VideoModel> | 39 | let videoPromise: Bluebird<VideoModel> |
39 | 40 | ||
40 | // Let Angular application handle errors | 41 | // Let Angular application handle errors |
41 | if (validator.isUUID(videoId, 4)) { | 42 | if (validator.isInt(videoId) || validator.isUUID(videoId, 4)) { |
42 | videoPromise = VideoModel.loadByUUIDAndPopulateAccountAndServerAndTags(videoId) | 43 | videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(videoId) |
43 | } else if (validator.isInt(videoId)) { | ||
44 | videoPromise = VideoModel.loadAndPopulateAccountAndServerAndTags(+videoId) | ||
45 | } else { | 44 | } else { |
46 | return ClientHtml.getIndexHTML(req, res) | 45 | return ClientHtml.getIndexHTML(req, res) |
47 | } | 46 | } |
@@ -150,7 +149,7 @@ export class ClientHtml { | |||
150 | description: videoDescriptionEscaped, | 149 | description: videoDescriptionEscaped, |
151 | thumbnailUrl: previewUrl, | 150 | thumbnailUrl: previewUrl, |
152 | uploadDate: video.createdAt.toISOString(), | 151 | uploadDate: video.createdAt.toISOString(), |
153 | duration: video.getActivityStreamDuration(), | 152 | duration: getActivityStreamDuration(video.duration), |
154 | contentUrl: videoUrl, | 153 | contentUrl: videoUrl, |
155 | embedUrl: embedUrl, | 154 | embedUrl: embedUrl, |
156 | interactionCount: video.views | 155 | interactionCount: video.views |