Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TrashbinMigrator without FilesMigrator errors on loading Files webview #96

Open
Pytal opened this issue Apr 12, 2022 · 13 comments
Open
Assignees
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working
Milestone

Comments

@Pytal
Copy link
Member

Pytal commented Apr 12, 2022

TrashbinMigrator runs export and import successfully without FilesMigrator but when loading the Files webview after importing it throws \OCP\Files\NotFoundException, details below

Technical details
Remote Address: 127.0.0.1
Request ID: nrGT0EYgBJXTsOLlwTTU
OCP\Files\NotFoundException
0
/var/www/nextcloud/lib/private/legacy/OC_Helper.php
496

Trace
#0 /var/www/nextcloud/apps/files/lib/Controller/ViewController.php(154): OC_Helper::getStorageInfo()
#1 /var/www/nextcloud/apps/files/lib/Controller/ViewController.php(204): OCA\Files\Controller\ViewController->getStorageInfo()
#2 /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(225): OCA\Files\Controller\ViewController->index()
#3 /var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php(133): OC\AppFramework\Http\Dispatcher->executeController()
#4 /var/www/nextcloud/lib/private/AppFramework/App.php(172): OC\AppFramework\Http\Dispatcher->dispatch()
#5 /var/www/nextcloud/lib/private/Route/Router.php(298): OC\AppFramework\App::main()
#6 /var/www/nextcloud/lib/base.php(1023): OC\Route\Router->match()
#7 /var/www/nextcloud/index.php(36): OC::handleRequest()
#8 {main}
@Pytal Pytal added 1. to develop Accepted and waiting to be taken care of bug Something isn't working labels Apr 12, 2022
@come-nc
Copy link
Collaborator

come-nc commented Apr 14, 2022

I’m failing to reproduce this, can you give exact instructions? Do I need to have something special in my trashbin?
Do I need to export/import through UI or console?

I put everything in the trash with a user and exported only trashbin, then I logged with another user and imported through UI, it worked, the files were in the trashbin and I can restore them.

@PVince81 PVince81 added this to the 0.1 milestone Apr 14, 2022
@come-nc
Copy link
Collaborator

come-nc commented Apr 14, 2022

So according to @Pytal this was happening using occ and commenting out the FilesMigrator.
As selecting migrators is not possible through occ in first version this can be looked at later. (when importing through the UI you have to upload the export file so you have to init filesystem and login before importing, so the problem does not occur)

@come-nc come-nc modified the milestones: 1.0, 1.1 Apr 14, 2022
@Pytal Pytal modified the milestones: 1.1, 1.2 Jul 22, 2022
@Pytal
Copy link
Member Author

Pytal commented Sep 29, 2022

Reproduced on server and user_migration stable25 branches

  1. Login as admin
  2. Upload some files and delete a few so they are in the trashbin
  3. Run occ user:export --types=trashbin admin <dir>
  4. Create user steve
  5. Run occ user:import --user=steve <archive_path>
  6. Login as steve and open Files webview

@come-nc
Copy link
Collaborator

come-nc commented Oct 13, 2022

Reproduced on server and user_migration stable25 branches

  1. Login as admin
  2. Upload some files and delete a few so they are in the trashbin
  3. Run occ user:export --types=trashbin admin <dir>
  4. Create user steve
  5. Run occ user:import --user=steve <archive_path>
  6. Login as steve and open Files webview

I’m still failing to reproduce an error.

I do have an empty list in files, but I cannot find where you see an Exception.

The empty list I think comes from the fact that the user after import is seen as having already connected before, I do not have the first run wizard either. But firstrunwizard use its own setting iirc, so not sure it is the same one for default files.

@Pytal
Copy link
Member Author

Pytal commented Oct 14, 2022

Probably only happens on a minimal setup with Apache2, SQLite, and APCu then 🤔

Also without the first run wizard

@Pytal Pytal modified the milestones: 1.2, 1.3 Oct 17, 2022
@come-nc
Copy link
Collaborator

come-nc commented Oct 17, 2022

Ideas:

  • May be time sensitive, if caching is involved
  • Maybe I did a user:info or so on the user that "fixed" the issue

@icewind1991 Could you give us some insight on user home folder creation?
When should it be created, and what would be the reason for it to trigger a filenotfound exception instead of just creating the folder?
Is it most likely related to files_trashbin folder existing or to some database content?

@szaimen
Copy link

szaimen commented Oct 17, 2022

  • Create user steve
  • Run occ user:import --user=steve <archive_path>
  • Login as steve and open Files webview

I guess this is the problem. without logging in first, the setup routine is not triggered. This is currently by design IIRC.

@come-nc
Copy link
Collaborator

come-nc commented Oct 18, 2022

  • Create user steve
  • Run occ user:import --user=steve <archive_path>
  • Login as steve and open Files webview

I guess this is the problem. without logging in first, the setup routine is not triggered. This is currently by design IIRC.

Ok, but where is the setup routine, and how can we trigger it in the import code?

@szaimen
Copy link

szaimen commented Oct 18, 2022

  • Create user steve
  • Run occ user:import --user=steve <archive_path>
  • Login as steve and open Files webview

I guess this is the problem. without logging in first, the setup routine is not triggered. This is currently by design IIRC.

Ok, but where is the setup routine, and how can we trigger it in the import code?

No idea, sry! Cc @blizzz maybe?

@blizzz
Copy link
Member

blizzz commented Oct 18, 2022

If my conclusion is correct from the last few comments, saml faces the same issue and uses a dirty hack: https://github.com/nextcloud/user_saml/blob/master/lib/UserBackend.php#L159-L172

But maybe my conclusions are wrong.

Normally this is called in \OC\User\Session::prepareUserLogin() which is called during any normal login procedure (user_saml is not normal 🙀 ).

@come-nc
Copy link
Collaborator

come-nc commented Oct 18, 2022

So it seems the problem comes from login/lastLogin config user value, which we should most likely not import, so that Nextcloud knows the first login is a first login.
But that means the default files would be copied into the user folder on first login, even if he imported files I think, which we do not want.

@come-nc
Copy link
Collaborator

come-nc commented Oct 18, 2022

(an other solution is to just create files folder when importing and hope that this is the only init cornercase we will encounter…)

@blizzz
Copy link
Member

blizzz commented Oct 18, 2022

That would be analogue to only this line https://github.com/nextcloud/user_saml/blob/master/lib/UserBackend.php#L162

@Pytal Pytal modified the milestones: 3.0, 4.0 Mar 30, 2023
@come-nc come-nc modified the milestones: 4.0, 5.0 May 16, 2023
@Pytal Pytal modified the milestones: 5.0, 6.0 Dec 1, 2023
@Pytal Pytal removed this from the 6.0 milestone Aug 22, 2024
@Pytal Pytal added this to the 8.0 milestone Aug 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1. to develop Accepted and waiting to be taken care of bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants