diff options
-rw-r--r-- | apps/workflowengine/lib/Check/FileSystemTags.php | 12 | ||||
-rw-r--r-- | lib/private/Files/Stream/SeekableHttpStream.php | 11 | ||||
-rw-r--r-- | psalm.xml | 5 |
3 files changed, 25 insertions, 3 deletions
diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php index b69f7492e02..a879a8e1703 100644 --- a/apps/workflowengine/lib/Check/FileSystemTags.php +++ b/apps/workflowengine/lib/Check/FileSystemTags.php @@ -6,6 +6,7 @@ * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author Joas Schilling <coding@schilljs.com> * @author Julius Härtl <jus@bitgrid.net> + * @author Richard Steinmetz <richard@steinmetz.cloud> * * @license GNU AGPL version 3 or any later version * @@ -131,8 +132,13 @@ class FileSystemTags implements ICheck, IFileCheck { * @return int[] */ protected function getFileIds(ICache $cache, $path, $isExternalStorage) { + // TODO: Fix caching inside group folders + // Do not cache file ids inside group folders because multiple file ids might be mapped to + // the same combination of cache id + path. + $shouldCacheFileIds = !$this->storage + ->instanceOfStorage(\OCA\GroupFolders\Mount\GroupFolderStorage::class); $cacheId = $cache->getNumericStorageId(); - if (isset($this->fileIds[$cacheId][$path])) { + if ($shouldCacheFileIds && isset($this->fileIds[$cacheId][$path])) { return $this->fileIds[$cacheId][$path]; } @@ -148,7 +154,9 @@ class FileSystemTags implements ICheck, IFileCheck { $parentIds[] = $cache->getId($path); } - $this->fileIds[$cacheId][$path] = $parentIds; + if ($shouldCacheFileIds) { + $this->fileIds[$cacheId][$path] = $parentIds; + } return $parentIds; } diff --git a/lib/private/Files/Stream/SeekableHttpStream.php b/lib/private/Files/Stream/SeekableHttpStream.php index c6d34e67cc9..af797c7720d 100644 --- a/lib/private/Files/Stream/SeekableHttpStream.php +++ b/lib/private/Files/Stream/SeekableHttpStream.php @@ -76,6 +76,8 @@ class SeekableHttpStream implements File { private $current; /** @var int */ private $offset = 0; + /** @var int */ + private $length = 0; private function reconnect(int $start) { $range = $start . '-'; @@ -101,12 +103,14 @@ class SeekableHttpStream implements File { $content = trim(explode(':', $contentRange)[1]); $range = trim(explode(' ', $content)[1]); $begin = intval(explode('-', $range)[0]); + $length = intval(explode('/', $range)[1]); if ($begin !== $start) { return false; } $this->offset = $begin; + $this->length = $length; return true; } @@ -140,7 +144,12 @@ class SeekableHttpStream implements File { } return $this->reconnect($this->offset + $offset); case SEEK_END: - return false; + if ($this->length === 0) { + return false; + } elseif ($this->length + $offset === $this->offset) { + return true; + } + return $this->reconnect($this->length + $offset); } return false; } diff --git a/psalm.xml b/psalm.xml index 5ccdb481e17..d51dbb9dde6 100644 --- a/psalm.xml +++ b/psalm.xml @@ -77,6 +77,11 @@ <file name="build/stubs/xsl.php"/> </stubs> <issueHandlers> + <UndefinedClass> + <errorLevel type="suppress"> + <referencedClass name="OCA\GroupFolders\Mount\GroupFolderStorage"/> + </errorLevel> + </UndefinedClass> <UndefinedFunction> <errorLevel type="suppress"> <!-- template functions: https://github.com/nextcloud/server/blob/6e8e34fef920a073118c22111f0f31eb3b3a91dc/lib/private/legacy/template/functions.php --> |