]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/streaming-playlists.ts
Use random names for VOD HLS playlists
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / streaming-playlists.ts
index db40c27befc96fd6743fdc2b1a4095e435be2986..a224b8f5f67a78fd2595c1ba8255e1889af58d6f 100644 (file)
@@ -1,6 +1,7 @@
 import { expect } from 'chai'
 import { basename } from 'path'
 import { sha256 } from '@server/helpers/core-utils'
+import { removeFragmentedMP4Ext } from '@shared/core-utils'
 import { HttpStatusCode, VideoStreamingPlaylist } from '@shared/models'
 import { PeerTubeServer } from '../server'
 
@@ -15,11 +16,11 @@ async function checkSegmentHash (options: {
   const { server, baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist } = options
   const command = server.streamingPlaylists
 
-  const playlist = await command.get({ url: `${baseUrlPlaylist}/${videoUUID}/${resolution}.m3u8` })
-
   const file = hlsPlaylist.files.find(f => f.resolution.id === resolution)
   const videoName = basename(file.fileUrl)
 
+  const playlist = await command.get({ url: `${baseUrlPlaylist}/${videoUUID}/${removeFragmentedMP4Ext(videoName)}.m3u8` })
+
   const matches = /#EXT-X-BYTERANGE:(\d+)@(\d+)/.exec(playlist)
 
   const length = parseInt(matches[1], 10)