proper cleanup and permission check for the hls directory (#1167)

* check error on hls cleanup

* rm HLS directories before creating new ones

* don't mask the variable

* mv cleanupDirectory() to utils

* add user-friendly error messages
This commit is contained in:
Meisam
2021-07-08 21:35:53 +02:00
committed by GitHub
parent 0e0199aa98
commit a13e1e75e2
3 changed files with 18 additions and 12 deletions

View File

@ -9,6 +9,7 @@ import (
"github.com/owncast/owncast/config"
"github.com/owncast/owncast/core/data"
"github.com/owncast/owncast/utils"
log "github.com/sirupsen/logrus"
)
@ -91,6 +92,9 @@ func handleTranscoderMessage(message string) {
func createVariantDirectories() {
// Create private hls data dirs
utils.CleanupDirectory(config.PublicHLSStoragePath)
utils.CleanupDirectory(config.PrivateHLSStoragePath)
if len(data.GetStreamOutputVariants()) != 0 {
for index := range data.GetStreamOutputVariants() {
err := os.MkdirAll(path.Join(config.PrivateHLSStoragePath, strconv.Itoa(index)), 0777)