summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRobin Appelman <icewind@owncloud.com>2015-07-17 14:44:24 +0200
committerRobin Appelman <icewind@owncloud.com>2015-10-01 13:14:47 +0200
commitdc49e767472ef67bcfd6318133537bef03ce7a7c (patch)
treeb36d046c6759b775e0b891c797152fa9cdf0f63d /lib
parent884e2fcd6ecd9a402619fced47b8b5c9a63a85dd (diff)
downloadnextcloud-server-dc49e767472ef67bcfd6318133537bef03ce7a7c.tar.gz
nextcloud-server-dc49e767472ef67bcfd6318133537bef03ce7a7c.zip
stricter check if thumbnail is cached
Diffstat (limited to 'lib')
-rw-r--r--lib/private/preview.php11
1 files changed, 4 insertions, 7 deletions
diff --git a/lib/private/preview.php b/lib/private/preview.php
index 41fc29e045f..24a9082b176 100644
--- a/lib/private/preview.php
+++ b/lib/private/preview.php
@@ -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;
}
}