From c917ea183ce0acf7c49f8c7104c9ffa54f2b804f Mon Sep 17 00:00:00 2001
From: Joas Schilling <nickvergessen@owncloud.com>
Date: Mon, 9 Mar 2015 18:20:51 +0100
Subject: [PATCH] Only check unique keys for the comparison on filecache insert
 & update otherwise

---
 lib/private/files/cache/cache.php | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/lib/private/files/cache/cache.php b/lib/private/files/cache/cache.php
index 62c32ce659..d39b59b23e 100644
--- a/lib/private/files/cache/cache.php
+++ b/lib/private/files/cache/cache.php
@@ -251,10 +251,15 @@ class Cache {
 				return trim($item, "`");
 			}, $queryParts);
 			$values = array_combine($queryParts, $params);
-			if (\OC::$server->getDatabaseConnection()->insertIfNotExist('*PREFIX*filecache', $values)) {
+			if (\OC::$server->getDatabaseConnection()->insertIfNotExist('*PREFIX*filecache', $values, [
+				'storage',
+				'path_hash',
+			])) {
 				return (int)\OC_DB::insertid('*PREFIX*filecache');
 			}
 
+			// The file was created in the mean time
+			$this->update($id, $data);
 			return $this->getId($file);
 		}
 	}
-- 
GitLab