From 5cd2c5263eec6a5ea0b9177bd478a8a32db3ca66 Mon Sep 17 00:00:00 2001 From: Jonas L Date: Wed, 21 Sep 2022 14:04:11 +0200 Subject: [PATCH] fix(legacy): prepend file id in tmp upload filename (#2173) Fix #1880 --- legacy/application/models/StoredFile.php | 5 +++-- legacy/application/services/MediaService.php | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/legacy/application/models/StoredFile.php b/legacy/application/models/StoredFile.php index 710942915..400fea502 100644 --- a/legacy/application/models/StoredFile.php +++ b/legacy/application/models/StoredFile.php @@ -913,12 +913,13 @@ SQL; * @param string $tempFilePath * @param string $originalFilename * @param bool $copyFile copy the file instead of moving it + * @param mixed $fileId * * @return Ambigous * * @throws Exception */ - public static function moveFileToStor($tempFilePath, $originalFilename, $copyFile = false) + public static function moveFileToStor($tempFilePath, $fileId, $originalFilename, $copyFile = false) { $audio_file = $tempFilePath; @@ -938,7 +939,7 @@ SQL; $audio_stor = Application_Common_OsPath::join( $stor, 'organize', - $originalFilename + $fileId . '-' . $originalFilename ); // if the uploaded file is not UTF-8 encoded, let's encode it. Assuming source // encoding is ISO-8859-1 diff --git a/legacy/application/services/MediaService.php b/legacy/application/services/MediaService.php index 72eb2b8bd..d0e47e964 100644 --- a/legacy/application/services/MediaService.php +++ b/legacy/application/services/MediaService.php @@ -29,7 +29,7 @@ class Application_Service_MediaService // Copy the temporary file over to the "organize" folder so that it's off our webserver // and accessible by libretime-analyzer which could be running on a different machine. - $newTempFilePath = Application_Model_StoredFile::moveFileToStor($filePath, $originalFilename, $copyFile); + $newTempFilePath = Application_Model_StoredFile::moveFileToStor($filePath, $fileId, $originalFilename, $copyFile); // Dispatch a message to libretime-analyzer through RabbitMQ, // notifying it that there's a new upload to process!