Encryption, decryption and sharing mess

Hey guys,
we have severe trouble bringing up again all files on our owncloud server.
We've enabled encryption and set a master password - although maybe too late as I cannot decrypt all files as admin.

One User shared 3-4 GBs in a lot of files with many others by link or by name and set specific rights for editing etc.
Than suddenly the problems appeared and users were not able to open/decrypt files anymore. It seems to me, that those users haven't been logged in before on the website but used only the desktop client or a share-link to see the files.
Anyway - due to the complexity we decided to disable encryption but - the admin wasn't able to decrypt all files! Even user by user with each users-password did not work properly as the app was deactivated during decrytion on the command line by typing sudo -u apache php occ encryption:decrypt --all [USER]

Long story short... How could I (as admin) possibly gain again access to all files and decrypt them on the shell - without the occ encryption command?
User passwords can be retrieved and shouldn't be an issue.

A developer should have a look at this issue. In the meantime, you can gather some more information that will be needed (version number, logfiles, ..., see what might be important to know: https://raw.githubusercontent.com/owncloud/core/master/issue_template.md).

Steps to reproduce

  1. re-enable encryption on webinterface as admin if not anabled
  2. go to cli and run: sudo -u apache php occ encryption:decrypt-all --all

Expected behaviour

decrypt all previously encrypted files

Actual behaviour

runs some time, than new lines are pasted on the shell for every file tried to decrypt. The App is no longer being displayed as active on the webinterface. Some files have been decrypted others remain encrypted

Server configuration

Operating system:
centos 7

Web server:
nginx 1.11

Database:
mysql 5.7

PHP version:
PHP 5.6.21, php-fpm

ownCloud version: (see ownCloud admin page)
9.0.4

Updated from an older ownCloud or fresh install:
fresh install

list of activated apps
Enabled:
- activity: 2.2.1
- comments: 0.2
- dav: 0.1.6
- encryption: 1.2.0
- federatedfilesharing: 0.1.0
- federation: 0.0.4
- files: 1.4.4
- files_pdfviewer: 0.8.1
- files_sharing: 0.9.1
- files_texteditor: 2.1
- files_trashbin: 0.8.0
- files_versions: 1.2.0
- files_videoplayer: 0.9.8
- firstrunwizard: 1.1
- gallery: 14.5.0
- provisioning_api: 0.4.1
- systemtags: 0.2
- templateeditor: 0.1
- updatenotification: 0.1.0
- user_ldap: 0.8.0

Problem solved. There was a trailing whitespace at the end of a folders name... :cookie:

You are not the first one with such a problem. And it is hard to debug. I posted a feature request to remove trailing whitespaces: