Skip to content

ExifMetadataProvider.php Doesn't Handle Unexpected Data Well #2635

Open
@nmbgeek

Description

@nmbgeek

Describe the bug
Parsing of GPS data needs to be improved for files with various metadata issues

To Reproduce
Steps to reproduce the behavior:
Upload a file with missing or non-standard GPS metadata

Expected behavior
Handle the missing metadata gracefully

Desktop (please complete the following information):

  • Server side error and UI hangs.
#2541 contains an image that will hang the UI when uploading due to non-standard metadata #2260 - The main issue may or may not be addressed by the pull request I will be uploading but many of the other respondents will be.

My error which is mentioned under #2260 but not identical to the main issue there.

{"reqId":"6l46zUo5lYmwpGUt04cf","level":2,"time":"2024-09-06T07:50:48-04:00","remoteAddr":"","user":"--","app":"no app in context","method":"","url":"--","message":"Error while generating metadata for fileid 44098","userAgent":"--","version":"29.0.6.1","exception":{"Exception":"TypeError","Message":"count(): Argument #1 ($value) must be of type Countable|array, null given","Code":0,"Trace":[{"file":"/var/www/nextcloud/apps/photos/lib/Listener/ExifMetadataProvider.php","line":130,"function":"count"},{"file":"/var/www/nextcloud/apps/photos/lib/Listener/ExifMetadataProvider.php","line":109,"function":"gpsDegreesToDecimal","class":"OCA\\Photos\\Listener\\ExifMetadataProvider","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/ServiceEventListener.php","line":86,"function":"handle","class":"OCA\\Photos\\Listener\\ExifMetadataProvider","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":230,"function":"__invoke","class":"OC\\EventDispatcher\\ServiceEventListener","type":"->"},{"file":"/var/www/nextcloud/3rdparty/symfony/event-dispatcher/EventDispatcher.php","line":59,"function":"callListeners","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":86,"function":"dispatch","class":"Symfony\\Component\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/EventDispatcher/EventDispatcher.php","line":98,"function":"dispatch","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/lib/private/FilesMetadata/FilesMetadataManager.php","line":114,"function":"dispatchTyped","class":"OC\\EventDispatcher\\EventDispatcher","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":126,"function":"refreshMetadata","class":"OC\\FilesMetadata\\FilesMetadataManager","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":109,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":109,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":98,"function":"scanFolder","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/core/BackgroundJobs/GenerateMetadataJob.php","line":84,"function":"scanFilesForUser","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/Job.php","line":80,"function":"run","class":"OC\\Core\\BackgroundJobs\\GenerateMetadataJob","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":102,"function":"start","class":"OCP\\BackgroundJob\\Job","type":"->"},{"file":"/var/www/nextcloud/lib/public/BackgroundJob/TimedJob.php","line":92,"function":"start","class":"OCP\\BackgroundJob\\TimedJob","type":"->"},{"file":"/var/www/nextcloud/cron.php","line":177,"function":"execute","class":"OCP\\BackgroundJob\\TimedJob","type":"->"}],"File":"/var/www/nextcloud/apps/photos/lib/Listener/ExifMetadataProvider.php","Line":130,"message":"Error while generating metadata for fileid 44098","exception":[],"CustomMessage":"Error while generating metadata for fileid 44098"},"id":"66daed2173aba"}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    0. Needs triagePending approval or rejection. This issue is pending approval.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions