From 05789e23bfd76bcc76b65191967525542f704490 Mon Sep 17 00:00:00 2001 From: Marco Szulik Date: Thu, 25 Jul 2024 12:43:59 +0200 Subject: [PATCH] fix an issue where files were falsely deleted --- app/Jobs/TranscodeVideo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Jobs/TranscodeVideo.php b/app/Jobs/TranscodeVideo.php index dcb0f7d..22bc5f0 100644 --- a/app/Jobs/TranscodeVideo.php +++ b/app/Jobs/TranscodeVideo.php @@ -112,7 +112,7 @@ public function failed(?Throwable $exception): void $localDisk->delete($this->getTempOriginalFilename()); $localDisk->deleteDirectory($this->getFfmpegTempDirectory()); // This directory stores local temp derivatives in case cloud storage is used. - $localDisk->deleteDirectory($this->version->Media->User->name); + $localDisk->deleteDirectory($this->getTempDerivativesDirectoryPath()); if (!$this->oldVersionNumber) { // A failed upload must not create a version. @@ -153,7 +153,7 @@ protected function transcodeVideo(): void $this->localDisk->delete($this->tempOriginalFilename); $this->localDisk->deleteDirectory($this->getFfmpegTempDirectory()); - $this->localDisk->deleteDirectory($this->version->Media->User->name); + $this->localDisk->deleteDirectory($this->getTempDerivativesDirectoryPath()); // Derivatives are generated at this point of time and located in the temporary folder. $this->moveDerivativesToDestinationPath(); @@ -225,7 +225,7 @@ protected function saveVideo(Streaming $video, string $format): void $video->save($this->derivativesDisk->path($tempDerivativeFilePath)); } else { // When using cloud storage, we save to local storage first and then upload manually, - // because the php-ffmpeg-video-streaming package direct upload functionality led to errors. + // because the php-ffmpeg-video-streaming package direct upload functionality led to S3 disconnects for large files. $video->save($this->localDisk->path($tempDerivativeFilePath)); $tempDerivativesFormatDirectoryPath = $this->getTempDerivativesFormatDirectoryPath($format);