diff options
author | Chocobozzz <me@florianbigard.com> | 2023-06-29 08:57:19 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2023-06-29 09:08:13 +0200 |
commit | ae22c59f14d0d553f60b281948b6c232c2aca178 (patch) | |
tree | 4d3b38ebcf7ff27966233b381e980a34112e943e /shared/server-commands | |
parent | ba278fa51dc578835c7fcb3a6eca4cd8cd86c755 (diff) | |
download | PeerTube-ae22c59f14d0d553f60b281948b6c232c2aca178.tar.gz PeerTube-ae22c59f14d0d553f60b281948b6c232c2aca178.tar.zst PeerTube-ae22c59f14d0d553f60b281948b6c232c2aca178.zip |
Fix broken replay with long live video name
Diffstat (limited to 'shared/server-commands')
-rw-r--r-- | shared/server-commands/videos/live.ts | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/shared/server-commands/videos/live.ts b/shared/server-commands/videos/live.ts index 48464fb61..cebadb1db 100644 --- a/shared/server-commands/videos/live.ts +++ b/shared/server-commands/videos/live.ts | |||
@@ -1,4 +1,5 @@ | |||
1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' | 1 | import ffmpeg, { FfmpegCommand } from 'fluent-ffmpeg' |
2 | import { truncate } from 'lodash' | ||
2 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' | 3 | import { buildAbsoluteFixturePath, wait } from '@shared/core-utils' |
3 | import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' | 4 | import { VideoDetails, VideoInclude, VideoPrivacy } from '@shared/models' |
4 | import { PeerTubeServer } from '../server/server' | 5 | import { PeerTubeServer } from '../server/server' |
@@ -104,7 +105,13 @@ async function findExternalSavedVideo (server: PeerTubeServer, liveDetails: Vide | |||
104 | 105 | ||
105 | const { data } = await server.videos.list({ token: server.accessToken, sort: '-publishedAt', include, privacyOneOf }) | 106 | const { data } = await server.videos.list({ token: server.accessToken, sort: '-publishedAt', include, privacyOneOf }) |
106 | 107 | ||
107 | return data.find(v => v.name === liveDetails.name + ' - ' + new Date(liveDetails.publishedAt).toLocaleString()) | 108 | const videoNameSuffix = ` - ${new Date(liveDetails.publishedAt).toLocaleString()}` |
109 | const truncatedVideoName = truncate(liveDetails.name, { | ||
110 | length: 120 - videoNameSuffix.length | ||
111 | }) | ||
112 | const toFind = truncatedVideoName + videoNameSuffix | ||
113 | |||
114 | return data.find(v => v.name === toFind) | ||
108 | } | 115 | } |
109 | 116 | ||
110 | export { | 117 | export { |