]> source.dussan.org Git - nextcloud-server.git/commitdiff
Restrict EXIF extracting to a subset of formats 38095/head
authorLouis Chemineau <louis@chmn.me>
Sat, 6 May 2023 15:33:55 +0000 (17:33 +0200)
committerLouis Chemineau <louis@chmn.me>
Tue, 9 May 2023 09:43:56 +0000 (11:43 +0200)
Signed-off-by: Louis Chemineau <louis@chmn.me>
lib/private/Metadata/Provider/ExifProvider.php

index 4e211e7b6c46e9da61c9c1da80a6ca29cbac7679..b1598abbbc8b72d36168d8780c4fca9fa613aaf4 100644 (file)
@@ -44,11 +44,15 @@ class ExifProvider implements IMetadataProvider {
                return extension_loaded('exif');
        }
 
-       /** @return array{'gps': FileMetadata, 'size': FileMetadata} */
+       /** @return array{'gps'?: FileMetadata, 'size'?: FileMetadata} */
        public function execute(File $file): array {
                $exifData = [];
                $fileDescriptor = $file->fopen('rb');
 
+               if ($fileDescriptor === false) {
+                       return [];
+               }
+
                $data = null;
                try {
                        // Needed to make reading exif data reliable.
@@ -107,7 +111,7 @@ class ExifProvider implements IMetadataProvider {
        }
 
        public static function getMimetypesSupported(): string {
-               return '/image\/.*/';
+               return '/image\/(png|jpeg|heif|webp|tiff)/';
        }
 
        /**