Skip to content

Commit

Permalink
fix an issue where files were falsely deleted
Browse files Browse the repository at this point in the history
  • Loading branch information
mszulik committed Jul 25, 2024
1 parent 49999dd commit 05789e2
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/Jobs/TranscodeVideo.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 05789e2

Please sign in to comment.