]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Fix hls redundancy pruning
authorChocobozzz <me@florianbigard.com>
Thu, 2 Sep 2021 13:10:30 +0000 (15:10 +0200)
committerChocobozzz <me@florianbigard.com>
Thu, 2 Sep 2021 13:10:40 +0000 (15:10 +0200)
scripts/prune-storage.ts

index 00141fec1a47add675581e8ebb6abe56a7d3bf28..9df80d5035154cb2eb8d1a6f257eed26f90a6d79 100755 (executable)
@@ -15,6 +15,7 @@ import { ActorImageModel } from '../server/models/actor/actor-image'
 import { uniq, values } from 'lodash'
 import { ThumbnailType } from '@shared/models'
 import { VideoFileModel } from '@server/models/video/video-file'
+import { HLS_REDUNDANCY_DIRECTORY } from '@server/initializers/constants'
 
 run()
   .then(() => process.exit(0))
@@ -121,6 +122,9 @@ async function doesRedundancyExist (filePath: string) {
   const isPlaylist = (await stat(filePath)).isDirectory()
 
   if (isPlaylist) {
+    // Don't delete HLS directory
+    if (filePath === HLS_REDUNDANCY_DIRECTORY) return true
+
     const uuid = getUUIDFromFilename(filePath)
     const video = await VideoModel.loadWithFiles(uuid)
     if (!video) return false