mirror of
https://github.com/nextcloud/server.git
synced 2026-04-22 14:50:17 -04:00
stricter check if thumbnail is cached
This commit is contained in:
parent
884e2fcd6e
commit
dc49e76747
1 changed files with 4 additions and 7 deletions
|
|
@ -479,7 +479,7 @@ class Preview {
|
|||
$preview = $this->buildCachePath($fileId, $previewWidth, $previewHeight);
|
||||
|
||||
// This checks if we have a preview of those exact dimensions in the cache
|
||||
if ($this->thumbnailSizeExists($allThumbnails, $previewWidth, $previewHeight)) {
|
||||
if ($this->thumbnailSizeExists($allThumbnails, basename($preview))) {
|
||||
return $preview;
|
||||
}
|
||||
|
||||
|
|
@ -528,16 +528,13 @@ class Preview {
|
|||
* Check if a specific thumbnail size is cached
|
||||
*
|
||||
* @param FileInfo[] $allThumbnails the list of all our cached thumbnails
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
* @param string $name
|
||||
* @return bool
|
||||
*/
|
||||
private function thumbnailSizeExists($allThumbnails, $width, $height) {
|
||||
private function thumbnailSizeExists($allThumbnails, $name) {
|
||||
|
||||
foreach ($allThumbnails as $thumbnail) {
|
||||
$name = $thumbnail['name'];
|
||||
list($cachedWidth, $cachedHeight) = $this->getDimensionsFromFilename($name);
|
||||
if ($cachedWidth === $width && $cachedHeight === $height) {
|
||||
if ($name === $thumbnail->getName()) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue