nextcloud / groupfolders

๐Ÿ“๐Ÿ‘ฉโ€๐Ÿ‘ฉโ€๐Ÿ‘งโ€๐Ÿ‘ฆ Admin-configured folders shared by everyone in a group. https://github.com/nextcloud-releases/groupfolders
https://apps.nextcloud.com/apps/groupfolders
284 stars 87 forks source link

4.0.1 breaks shares and fulltext-search on Nextcloud 16 - Call to a member function getUID() on null #440

Closed mtippmann closed 3 years ago

mtippmann commented 5 years ago

Since updating to Groupfolders 4.0.1 (from 4.0.0) shares are broken for me.

{
  "reqId": "kkBaMnKvGuF5QANOeDUO",
  "level": 3,
  "time": "2019-05-22T07:53:16+00:00",
  "remoteAddr": "91.137.5.26",
  "user": "--",
  "app": "index",
  "method": "GET",
  "url": "/s/sXnEdKJyFaLBBk2",
  "message": {
    "Exception": "Error",
    "Message": "Call to a member function getUID() on null",
    "Code": 0,
    "Trace": [
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php",
        "line": 126,
        "function": "getCurrentUID",
        "class": "OCA\\GroupFolders\\Mount\\MountProvider",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php",
        "line": 90,
        "function": "getMount",
        "class": "OCA\\GroupFolders\\Mount\\MountProvider",
        "type": "->",
        "args": [
          8,
          "/mt/files/Maschinenraum",
          31,
          -3,
          {
            "__class__": "OC\\Files\\Cache\\CacheEntry"
          },
          {
            "__class__": "OC\\Files\\Storage\\StorageFactory"
          },
          true,
          {
            "__class__": "OC\\User\\User"
          }
        ]
      },
      {
        "function": "OCA\\GroupFolders\\Mount\\{closure}",
        "class": "OCA\\GroupFolders\\Mount\\MountProvider",
        "type": "->",
        "args": [
          "*** sensitive parameters replaced ***"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php",
        "line": 88,
        "function": "array_map",
        "args": [
          {
            "__class__": "Closure"
          },
          [
            "*** sensitive parameter replaced ***",
            {
              "folder_id": 11,
              "mount_point": "weimarnetz",
              "permissions": 31,
              "quota": -3,
              "acl": true,
              "rootCacheEntry": {
                "__class__": "OC\\Files\\Cache\\CacheEntry"
              }
            }
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Config/MountProviderCollection.php",
        "line": 103,
        "function": "getMountsForUser",
        "class": "OCA\\GroupFolders\\Mount\\MountProvider",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          {
            "__class__": "OC\\Files\\Storage\\StorageFactory"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Filesystem.php",
        "line": 447,
        "function": "addMountForUser",
        "class": "OC\\Files\\Config\\MountProviderCollection",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\User\\User"
          },
          {
            "__class__": "OC\\Files\\Mount\\Manager"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/Root.php",
        "line": 375,
        "function": "initMountPoints",
        "class": "OC\\Files\\Filesystem",
        "type": "::",
        "args": [
          "mt"
        ]
      },
      {
        "function": "getUserFolder",
        "class": "OC\\Files\\Node\\Root",
        "type": "->",
        "args": [
          "mt"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/LazyRoot.php",
        "line": 64,
        "function": "call_user_func_array",
        "args": [
          [
            {
              "__class__": "OC\\Files\\Node\\Root"
            },
            "getUserFolder"
          ],
          [
            "mt"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Files/Node/LazyRoot.php",
        "line": 281,
        "function": "__call",
        "class": "OC\\Files\\Node\\LazyRoot",
        "type": "->",
        "args": [
          "getUserFolder",
          [
            "mt"
          ]
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Share20/Share.php",
        "line": 175,
        "function": "getUserFolder",
        "class": "OC\\Files\\Node\\LazyRoot",
        "type": "->",
        "args": [
          "mt"
        ]
      },
      {
        "file": "/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareController.php",
        "line": 269,
        "function": "getNode",
        "class": "OC\\Share20\\Share",
        "type": "->",
        "args": []
      },
      {
        "file": "/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareController.php",
        "line": 293,
        "function": "validateShare",
        "class": "OCA\\Files_Sharing\\Controller\\ShareController",
        "type": "->",
        "args": [
          {
            "__class__": "OC\\Share20\\Share"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 166,
        "function": "showShare",
        "class": "OCA\\Files_Sharing\\Controller\\ShareController",
        "type": "->",
        "args": [
          ""
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php",
        "line": 99,
        "function": "executeController",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareController"
          },
          "showShare"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/App.php",
        "line": 126,
        "function": "dispatch",
        "class": "OC\\AppFramework\\Http\\Dispatcher",
        "type": "->",
        "args": [
          {
            "__class__": "OCA\\Files_Sharing\\Controller\\ShareController"
          },
          "showShare"
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/AppFramework/Routing/RouteActionHandler.php",
        "line": 47,
        "function": "main",
        "class": "OC\\AppFramework\\App",
        "type": "::",
        "args": [
          "OCA\\Files_Sharing\\Controller\\ShareController",
          "showShare",
          {
            "__class__": "OC\\AppFramework\\DependencyInjection\\DIContainer"
          },
          {
            "token": "sXnEdKJyFaLBBk2",
            "_route": "files_sharing.sharecontroller.showShare"
          }
        ]
      },
      {
        "function": "__invoke",
        "class": "OC\\AppFramework\\Routing\\RouteActionHandler",
        "type": "->",
        "args": [
          {
            "token": "sXnEdKJyFaLBBk2",
            "_route": "files_sharing.sharecontroller.showShare"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/private/Route/Router.php",
        "line": 297,
        "function": "call_user_func",
        "args": [
          {
            "__class__": "OC\\AppFramework\\Routing\\RouteActionHandler"
          },
          {
            "token": "sXnEdKJyFaLBBk2",
            "_route": "files_sharing.sharecontroller.showShare"
          }
        ]
      },
      {
        "file": "/var/www/nextcloud/lib/base.php",
        "line": 975,
        "function": "match",
        "class": "OC\\Route\\Router",
        "type": "->",
        "args": [
          "/s/sXnEdKJyFaLBBk2"
        ]
      },
      {
        "file": "/var/www/nextcloud/index.php",
        "line": 42,
        "function": "handleRequest",
        "class": "OC",
        "type": "::",
        "args": []
      }
    ],
    "File": "/var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php",
    "Line": 113,
    "CustomMessage": "--"
  },
  "userAgent": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36",
  "version": "16.0.1.1"
}
mtippmann commented 5 years ago

Reverting the Groupfolders addon to 4.0.0 fixes the problem. The share here is public if that matters. Nextcloud 16.0.1

ShinjiLE commented 5 years ago

It also breaks fulltextsearch : "An unhandled exception has been thrown: Error: Call to a member function getUID() on null in /var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php:113 Stack trace:

0 /var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php(126): OCA\GroupFolders\Mount\MountProvider->getCurrentUID()

1 /var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php(90): OCA\GroupFolders\Mount\MountProvider->getMount(1, '/Sebastian/file...', 31, 104857600, Object(OC\Files\Cache\CacheEntry), Object(OC\Files\Storage\StorageFactory), true, Object(OC\User\User))

2 [internal function]: OCA\GroupFolders\Mount\MountProvider->OCA\GroupFolders\Mount{closure}(Array)

3 /var/www/nextcloud/apps/groupfolders/lib/Mount/MountProvider.php(88): array_map(Object(Closure), Array)

4 /var/www/nextcloud/lib/private/Files/Config/MountProviderCollection.php(103): OCA\GroupFolders\Mount\MountProvider->getMountsForUser(Object(OC\User\User), Object(OC\Files\Storage\StorageFactory))

5 /var/www/nextcloud/lib/private/Files/Filesystem.php(447): OC\Files\Config\MountProviderCollection->addMountForUser(Object(OC\User\User), Object(OC\Files\Mount\Manager))

6 /var/www/nextcloud/lib/private/Files/Node/Root.php(375): OC\Files\Filesystem::initMountPoints('Sebastian')

7 [internal function]: OC\Files\Node\Root->getUserFolder('Sebastian')

8 /var/www/nextcloud/lib/private/Files/Node/LazyRoot.php(64): call_user_func_array(Array, Array)

9 /var/www/nextcloud/lib/private/Files/Node/LazyRoot.php(281): OC\Files\Node\LazyRoot->__call('getUserFolder', Array)

10 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(474): OC\Files\Node\LazyRoot->getUserFolder('Sebastian')

11 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(737): OCA\Files_FullTextSearch\Service\FilesService->getPathFromViewerId(1036333, 'Sebastian')

12 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(652): OCA\Files_FullTextSearch\Service\FilesService->updateShareNames(Object(OCA\Files_FullTextSearch\Model\FilesDocument), Object(OC\Files\Node\File))

13 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(626): OCA\Files_FullTextSearch\Service\FilesService->updateDocumentAccess(Object(OCA\Files_FullTextSearch\Model\FilesDocument), Object(OC\Files\Node\File))

14 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(607): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocumentFromFile(Object(OCA\Files_FullTextSearch\Model\FilesDocument), Object(OC\Files\Node\File))

15 /var/www/nextcloud/apps/files_fulltextsearch/lib/Service/FilesService.php(501): OCA\Files_FullTextSearch\Service\FilesService->updateFilesDocument(Object(OCA\Files_FullTextSearch\Model\FilesDocument))

16 /var/www/nextcloud/apps/files_fulltextsearch/lib/Provider/FilesProvider.php(263): OCA\Files_FullTextSearch\Service\FilesService->generateDocument(Object(OCA\Files_FullTextSearch\Model\FilesDocument))

17 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(325): OCA\Files_FullTextSearch\Provider\FilesProvider->fillIndexDocument(Object(OCA\Files_FullTextSearch\Model\FilesDocument))

18 /var/www/nextcloud/apps/fulltextsearch/lib/Service/IndexService.php(205): OCA\FullTextSearch\Service\IndexService->indexDocuments(Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\Files_FullTextSearch\Provider\FilesProvider), Array, Object(OCA\FullTextSearch\Model\IndexOptions))

19 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(409): OCA\FullTextSearch\Service\IndexService->indexProviderContentFromUser(Object(OCA\FullTextSearch_ElasticSearch\Platform\ElasticSearchPlatform), Object(OCA\Files_FullTextSearch\Provider\FilesProvider), 'ChristianS', Object(OCA\FullTextSearch\Model\IndexOptions))

20 /var/www/nextcloud/apps/fulltextsearch/lib/Command/Index.php(273): OCA\FullTextSearch\Command\Index->indexProvider(Object(OCA\Files_FullTextSearch\Provider\FilesProvider), Object(OCA\FullTextSearch\Model\IndexOptions))

21 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(255): OCA\FullTextSearch\Command\Index->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

22 /var/www/nextcloud/core/Command/Base.php(166): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

23 /var/www/nextcloud/3rdparty/symfony/console/Application.php(901): OC\Core\Command\Base->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

24 /var/www/nextcloud/3rdparty/symfony/console/Application.php(262): Symfony\Component\Console\Application->doRunCommand(Object(OCA\FullTextSearch\Command\Index), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

25 /var/www/nextcloud/3rdparty/symfony/console/Application.php(145): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

26 /var/www/nextcloud/lib/private/Console/Application.php(213): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))

27 /var/www/nextcloud/console.php(97): OC\Console\Application->run()

28 /var/www/nextcloud/occ(11): require_once('/var/www/nextcl...')

29 {main}"

RonMen commented 5 years ago

Hi,

I reverted "/lib/Mount/MountProvider.php" and then was able again to share to federated clouds. It was broken since the update to 4.0.1.

Regards RonMen

janbenda commented 5 years ago

public (user not logged) sharelinks are broken: "Message":"Call to a member function getUID() on null", "Code":0,"Trace":[{"file":"\/var\/www\/html\/custom_apps\/groupfolders\/lib\/Mount\/MountProvider.php","line":126,"function":"getCurrentUID"

/var/www/html/custom_apps/groupfolders/lib/Mount/MountProvider.php public function getMount this line (126) is wrong: $inShare = $this->getCurrentUID() === null || $this->getCurrentUID() !== $user->getUID();

that works $inShare = $this->userSession->getUser() === null || $this->getCurrentUID() !== $user->getUID();

ShinjiLE commented 5 years ago

I think this is fixed with 4.0.2.

ZeikoFr commented 3 years ago

Hi @mtippmann

As group folder is now at v8.0.2 I suppose this issue can be closed ?

Regards,

mtippmann commented 3 years ago

@ZeikoFr we stopped using fulltextsearch but I guess this is fixed.