diff options
author | Simon L <szaimen@e.mail.de> | 2023-05-30 10:51:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-05-30 10:51:33 +0200 |
commit | 1e1e2fec64aa7dc5e8656bbee9c09494402420af (patch) | |
tree | a25f7cb573e781087a42754179db2410475c1575 /lib | |
parent | 45d7cee7f8220775b0229da5f5cd61fe7456c6c6 (diff) | |
parent | 0670ae607b730e75024794705b7e9dbfd801bcb1 (diff) | |
download | nextcloud-server-1e1e2fec64aa7dc5e8656bbee9c09494402420af.tar.gz nextcloud-server-1e1e2fec64aa7dc5e8656bbee9c09494402420af.zip |
Merge pull request #38496 from nextcloud/preview-mp3-catch-errors
fix: catch errors in id3parser library
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Preview/MP3.php | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/private/Preview/MP3.php b/lib/private/Preview/MP3.php index 47d752af477..ff6ff86c966 100644 --- a/lib/private/Preview/MP3.php +++ b/lib/private/Preview/MP3.php @@ -32,6 +32,7 @@ use ID3Parser\ID3Parser; use OCP\Files\File; use OCP\IImage; +use Psr\Log\LoggerInterface; class MP3 extends ProviderV2 { /** @@ -48,8 +49,18 @@ class MP3 extends ProviderV2 { $getID3 = new ID3Parser(); $tmpPath = $this->getLocalFile($file); - $tags = $getID3->analyze($tmpPath); - $this->cleanTmpFiles(); + try { + $tags = $getID3->analyze($tmpPath); + } catch (\Throwable $e) { + \OC::$server->get(LoggerInterface::class)->info($e->getMessage(), [ + 'exception' => $e, + 'app' => 'core', + ]); + return null; + } finally { + $this->cleanTmpFiles(); + } + $picture = isset($tags['id3v2']['APIC'][0]['data']) ? $tags['id3v2']['APIC'][0]['data'] : null; if (is_null($picture) && isset($tags['id3v2']['PIC'][0]['data'])) { $picture = $tags['id3v2']['PIC'][0]['data']; |