You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, log exceptions are generated when previews for MP3 files are being created, like:
{"reqId":"8q3EycderbaJ2eO5Hyc9","level":3,"time":"2024-01-04T21:19:44+00:00","remoteAddr":"xx.x.xxx.xxx","user":"admin","app":"PHP","method":"GET","url":"\/owncloud10134\/remote.php\/dav\/files\/admin\/file_example_MP3_1MG.mp3?c=faaf02aa4049f8cd054e634034dcdb58&x=64&y=64&forceIcon=0&preview=1","message":"file_get_contents(\/var\/www\/html\/owncloud10134\/data\/admin\/files\/var\/www\/html\/owncloud10134\/core\/img\/filetypes\/audio.svg): failed to open stream: No such file or directory at \/var\/www\/html\/owncloud10134\/lib\/private\/Files\/Storage\/Local.php#227"}
{"reqId":"8q3EycderbaJ2eO5Hyc9","level":3,"time":"2024-01-04T21:19:44+00:00","remoteAddr":"xx.xx.xxx.xxx","user":"admin","app":"PHP","method":"GET","url":"\/owncloud10134\/remote.php\/dav\/files\/admin\/file_example_MP3_1MG.mp3?c=faaf02aa4049f8cd054e634034dcdb58&x=64&y=64&forceIcon=0&preview=1","message":"imagecreatefromstring(): Empty string or invalid image at \/var\/www\/html\/owncloud10134\/lib\/private\/legacy\/image.php#702"}
How Has This Been Tested?
Manually, by making sure that such exceptions are no longer logged.
Types of changes
Bug fix (non-breaking change which fixes an issue)
New feature (non-breaking change which adds functionality)
Database schema changes (next release will require increase of minor version instead of patch)
Breaking change (fix or feature that would cause existing functionality to change)
The problem might be deeper.... It seems there is inconsistencies about how the image is loaded with the loadFromFile method, and we should probably recheck the rest of the methods too.
We're checking the filetype of the target file /var/www/html/owncloud10134/core/img/filetypes/audio.svg. The problem is that the SVG format isn't part of the filetypes we're handling in the loadFromFile, so it goes through the default method, and the default method uses the ownCloud's FS, so we're searching the file inside the user's primary storage. This is why the error appears.
Basically, using loadFromFile with SVG files is discouraged. I'm not sure if it works.
Using loadFromFileHandle should work. We shouldn't need to use any Imagick class on our own, and let our Image do the loading.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fix log exceptions for mp3 preview
Related Issue
Motivation and Context
Currently, log exceptions are generated when previews for MP3 files are being created, like:
How Has This Been Tested?
Types of changes
Checklist: