Skip to content

Commit 38ab332

Browse files
Mark-HopengeekJoshuaLuckers
authored
Fix empty files not being clickable in the file tree (#15985)
* Fix empty files not being clickable in the file tree, due to unrecognised application/x-empty mime type * Update core/src/Revolution/Sources/modMediaSource.php Co-authored-by: Joshua Lückers <[email protected]> Co-authored-by: Jason Coward <[email protected]> Co-authored-by: Joshua Lückers <[email protected]>
1 parent 7a93112 commit 38ab332

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/src/Revolution/Sources/modMediaSource.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -2216,7 +2216,7 @@ protected function buildManagerImagePreview($path, $ext, $width, $height, $bases
22162216
}
22172217
if (function_exists('exif_read_data')) {
22182218
$exif = @exif_read_data($absolute_path);
2219-
if (!empty($exif) && $exif['Orientation'] >= 5) {
2219+
if (!empty($exif) && array_key_exists('Orientation', $exif) && $exif['Orientation'] >= 5) {
22202220
// This image was rotated
22212221
$new_width = $size['height'];
22222222
$new_height = $size['width'];
@@ -2331,6 +2331,7 @@ protected function isFileBinary($file)
23312331
{
23322332
try {
23332333
$mime = $this->filesystem->mimeType($file);
2334+
$this->xpdo->log(xPDO::LOG_LEVEL_DEBUG, $file . ' has a mime type of: ' . $mime);
23342335

23352336
// Some mimetypes include a character set, e.g. application/json; charset=utf-8
23362337
// so we filter out the last part to make comparison easier
@@ -2347,6 +2348,7 @@ protected function isFileBinary($file)
23472348
'image/svg+xml',
23482349
'application/xhtml+xml',
23492350
'application/xml',
2351+
'application/x-empty',
23502352
), true);
23512353
} catch (Exception $e) {
23522354
// pass

0 commit comments

Comments
 (0)