From d403fd20f1f0b4e0a8fc4fd98a1593277953500a Mon Sep 17 00:00:00 2001 From: Gabe Kangas Date: Wed, 14 Oct 2020 17:32:02 -0700 Subject: [PATCH] Do not auto-delete file on storage save. Add firing cleanup method --- core/storageproviders/s3Storage.go | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/core/storageproviders/s3Storage.go b/core/storageproviders/s3Storage.go index b31caafcd..9ea8bc0c1 100644 --- a/core/storageproviders/s3Storage.go +++ b/core/storageproviders/s3Storage.go @@ -6,6 +6,7 @@ import ( "os" "path/filepath" + "github.com/owncast/owncast/core/ffmpeg" "github.com/owncast/owncast/core/playlist" "github.com/owncast/owncast/utils" log "github.com/sirupsen/logrus" @@ -99,10 +100,6 @@ func (s *S3Storage) SegmentWritten(localFilePath string) { return } } - - // If a segment file was successfully uploaded then we can delete - // it from the local filesystem. - os.Remove(localFilePath) } // VariantPlaylistWritten is called when a variant hls playlist is written @@ -163,6 +160,8 @@ func (s *S3Storage) Save(filePath string, retryCount int) (string, error) { } } + ffmpeg.Cleanup(filepath.Dir(filePath)) + return response.Location, nil }