Skip to content

Fix empty files not being clickable in the file tree (#15976) #15985

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 24, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion core/src/Revolution/Sources/modMediaSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -2216,7 +2216,7 @@ protected function buildManagerImagePreview($path, $ext, $width, $height, $bases
}
if (function_exists('exif_read_data')) {
$exif = @exif_read_data($absolute_path);
if (!empty($exif) && $exif['Orientation'] >= 5) {
if (!empty($exif) && array_key_exists('Orientation', $exif) && $exif['Orientation'] >= 5) {
// This image was rotated
$new_width = $size['height'];
$new_height = $size['width'];
Expand Down Expand Up @@ -2331,6 +2331,7 @@ protected function isFileBinary($file)
{
try {
$mime = $this->filesystem->mimeType($file);
$this->xpdo->log(xPDO::LOG_LEVEL_DEBUG, $file . ' has a mime type of: ' . $mime);

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