diff --git a/apps/files_sharing/lib/cache.php b/apps/files_sharing/lib/cache.php
index 07c305bb95204c798ee6e570dba8117245fb0a4f..0534d6dd89fc4ad871b7fe830c9bc9299fcc0500 100644
--- a/apps/files_sharing/lib/cache.php
+++ b/apps/files_sharing/lib/cache.php
@@ -48,6 +48,7 @@ class Shared_Cache extends Cache {
 			if ($storage) {
 				$this->files[$target] = $internalPath;
 				$cache = $storage->getCache();
+				$this->storageId = $storage->getId();
 				$this->numericId = $cache->getNumericStorageId();
 				return $cache;
 			}