Repro
- As Alice on Instance One, have default folder for acceptes shares set to
/Inbox in Personal Settings → Sharing (might be optional)
- As Bob on Instance Two share a folder through federation to Alice at Instance One
- As Alice accept the share and reload Files
- As admin run
occ files:scan --verbose alice on Instance One3. As Alice accept reload Files once more
Observed:
- The shared folder does not appear under
/Inbox as configure, but within the user home
- The Size is set as "Pending" and stays so
- The Modified date is set as "Unknown date" and stays so
- The occ command lists the received folder, but instead of the actual contents those
files and uploads as content
- The occ command crashes with a
TypeError
Details
occ output as file list
```
…
Folder /master/files/Five five five/
Folder /master/files/Five five five/files
Folder /master/files/Five five five/uploads
An unhandled exception has been thrown:
…
```
Exception stacktrace
```
TypeError: OC\Files\Cache\CacheQueryBuilder::whereParent(): Argument #1 ($parent) must be of type int, null given, called in /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php on line 1050 and defined in /srv/http/nextcloud/master/lib/private/Files/Cache/CacheQueryBuilder.php:89
Stack trace:
#0 /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php(1050): OC\Files\Cache\CacheQueryBuilder->whereParent(NULL)
#1 /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php(1023): OC\Files\Cache\Cache->calculateFolderSizeInner('', Object(OC\Files\Cache\CacheEntry))
#2 /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php(969): OC\Files\Cache\Cache->calculateFolderSize('', NULL)
#3 /srv/http/nextcloud/master/lib/private/Files/Utils/Scanner.php(237): OC\Files\Cache\Cache->correctFolderSize('')
#4 /srv/http/nextcloud/master/apps/files/lib/Command/Scan.php(169): OC\Files\Utils\Scanner->scan('...', true, Object(Closure))
#5 /srv/http/nextcloud/master/apps/files/lib/Command/Scan.php(260): OCA\Files\Command\Scan->scanFiles('...', '...', NULL, Object(Symfony\Component\Console\Output\ConsoleOutput), Object(Closure), false, true)
#6 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Command/Command.php(341): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#7 /srv/http/nextcloud/master/core/Command/Base.php(222): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Application.php(1079): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#9 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Application.php(356): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#10 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#11 /srv/http/nextcloud/master/lib/private/Console/Application.php(188): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#12 /srv/http/nextcloud/master/console.php(92): OC\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput))
#13 /srv/http/nextcloud/master/occ(33): require_once('...')
#14 {main}
```
The problem with the code is that
expects the
fileid to be set, but in this case, the field does not exist, is not checked, and is later unconditionally passed to
whereParent() which expects an int.
Repro
/Inboxin Personal Settings → Sharing (might be optional)occ files:scan --verbose aliceon Instance One3. As Alice accept reload Files once moreObserved:
/Inboxas configure, but within the user homefilesanduploadsas contentTypeErrorDetails
occ output as file list
``` … Folder /master/files/Five five five/ Folder /master/files/Five five five/files Folder /master/files/Five five five/uploads An unhandled exception has been thrown: … ```Exception stacktrace
``` TypeError: OC\Files\Cache\CacheQueryBuilder::whereParent(): Argument #1 ($parent) must be of type int, null given, called in /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php on line 1050 and defined in /srv/http/nextcloud/master/lib/private/Files/Cache/CacheQueryBuilder.php:89 Stack trace: #0 /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php(1050): OC\Files\Cache\CacheQueryBuilder->whereParent(NULL) #1 /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php(1023): OC\Files\Cache\Cache->calculateFolderSizeInner('', Object(OC\Files\Cache\CacheEntry)) #2 /srv/http/nextcloud/master/lib/private/Files/Cache/Cache.php(969): OC\Files\Cache\Cache->calculateFolderSize('', NULL) #3 /srv/http/nextcloud/master/lib/private/Files/Utils/Scanner.php(237): OC\Files\Cache\Cache->correctFolderSize('') #4 /srv/http/nextcloud/master/apps/files/lib/Command/Scan.php(169): OC\Files\Utils\Scanner->scan('...', true, Object(Closure)) #5 /srv/http/nextcloud/master/apps/files/lib/Command/Scan.php(260): OCA\Files\Command\Scan->scanFiles('...', '...', NULL, Object(Symfony\Component\Console\Output\ConsoleOutput), Object(Closure), false, true) #6 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Command/Command.php(341): OCA\Files\Command\Scan->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #7 /srv/http/nextcloud/master/core/Command/Base.php(222): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #8 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Application.php(1079): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #9 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Application.php(356): Symfony\Component\Console\Application->doRunCommand(Object(OCA\Files\Command\Scan), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #10 /srv/http/nextcloud/master/apps-repos/workflow_pdf_converter/vendor/symfony/console/Application.php(195): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #11 /srv/http/nextcloud/master/lib/private/Console/Application.php(188): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput)) #12 /srv/http/nextcloud/master/console.php(92): OC\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput)) #13 /srv/http/nextcloud/master/occ(33): require_once('...') #14 {main} ```The problem with the code is that
server/lib/private/Files/Cache/Cache.php
Line 1041 in fd14234
fileidto be set, but in this case, the field does not exist, is not checked, and is later unconditionally passed towhereParent()which expects an int.