Skip to content

Commit

Permalink
Restrict EXIF extracting to a subset of formats
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <louis@chmn.me>
  • Loading branch information
artonge committed May 9, 2023
1 parent 157be42 commit b67e34f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/private/Metadata/Provider/ExifProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,15 @@ public static function isAvailable(): bool {
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.
Expand Down Expand Up @@ -107,7 +111,7 @@ public function execute(File $file): array {
}

public static function getMimetypesSupported(): string {
return '/image\/.*/';
return '/image\/(png|jpeg|heif|webp|tiff)/';
}

/**
Expand Down

0 comments on commit b67e34f

Please sign in to comment.