Skip to content

A self-hosted media server and file management system

fix: tmp files are leftover if ffmpeg fails on embeduid

aminnausin284eb581e5d8
diff --git a/app/Jobs/EmbedUidInMetadata.php b/app/Jobs/EmbedUidInMetadata.php
index 980b338f..bb8dffdf 100644
--- a/app/Jobs/EmbedUidInMetadata.php
+++ b/app/Jobs/EmbedUidInMetadata.php
@@ -114,11 +114,13 @@ class EmbedUidInMetadata extends ManagedSubTask {
}
}
- $this->addMetadataWithFFMpeg($format, $tempFilePath);
-
- if (file_exists($tempFilePath)) {
- dump("Cleaning up temporary file: $tempFilePath");
- unlink($tempFilePath); // delete the temp file
+ try {
+ $this->addMetadataWithFFMpeg($format, $tempFilePath);
+ } finally {
+ if (file_exists($tempFilePath)) {
+ dump("Cleaning up temporary file: $tempFilePath");
+ unlink($tempFilePath); // delete the temp file
+ }
}
return ' FFmpeg';