Skip to content
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

fix(previews): Stop returning true when getimagesize() fails #46342

Merged
merged 1 commit into from
Jul 16, 2024
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
6 changes: 3 additions & 3 deletions lib/private/legacy/OC_Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -569,7 +569,7 @@ private function checkImageMemory($width, $height) {
private function checkImageSize($path) {
$size = @getimagesize($path);
if (!$size) {
return true;
return false;
}

$width = $size[0];
Expand All @@ -590,7 +590,7 @@ private function checkImageSize($path) {
private function checkImageDataSize($data) {
$size = @getimagesizefromstring($data);
if (!$size) {
return true;
return false;
}

$width = $size[0];
Expand Down Expand Up @@ -637,7 +637,7 @@ public function loadFromFile($imagePath = false) {
if (!$this->checkImageSize($imagePath)) {
return false;
}
if (getimagesize($imagePath) !== false) {
if (@getimagesize($imagePath) !== false) {
$this->resource = @imagecreatefromjpeg($imagePath);
} else {
$this->logger->debug('OC_Image->loadFromFile, JPG image not valid: ' . $imagePath, ['app' => 'core']);
Expand Down
Loading