Sharing files to external Users fail: Can't read file

Nextcloud version : 12.0.4
Operating system : Ubuntu 16.04.3 LTS
Apache : 2.4.18
PHP version : 7.0.22

The issue you are facing:
Getting Error Message when trying to share files to non Nextcloud users via E-Mail
Error Message:

“Can’t read file
Diese Datei kann nicht gelesen werden, es handelt sich wahrscheinlich um eine geteilte Datei. Bitte kontaktieren sie den Eigentümer der Datei und bitten Sie darum, die Datei noch einmal mit Ihnen zu teilen.”

Trying to translate with my poor english:

This file can not be read, this is most likely a shared file. Please contact the owner of the file and ask him to share the file again with you.

I am new to Ubuntu and configured everything just like it is explained in the official documentation.
I am facing this issue with all files that have been created after i enabled the server side encryption.
In the meantime i disabled encryption but im still facing the same problem. See the logs below for more information.

I’ve read that this has something todo with the Masterkey to be used for external users instead of the public key, but as i already said i am new to Ubuntu as well as a nextcloud administration and would appreciate some help before i start touching anything on the system.

Is this the first time you’ve seen this error? Yes

Steps to replicate it:

  1. Log in as any Nextcloud user
  2. Share any file which has been created after the server sided encryption has been applied via E-Mail with any non Nextcloud user (Password protection doesnt affect the issue)
  3. After receiving the Link via E-Mail and clicking it the following happens:
    In this example a picture has to be shared
    The Picture can be displayed in the browser, but after clicking download an error message is displayed on the screen saying: Can’t read file

Applist:


Enabled:
  - activity: 2.5.2
  - bruteforcesettings: 1.0.3
  - comments: 1.2.0
  - dav: 1.3.0
  - encryption: 1.6.0
  - federatedfilesharing: 1.2.0
  - federation: 1.2.0
  - files: 1.7.2
  - files_pdfviewer: 1.1.1
  - files_sharing: 1.4.0
  - files_texteditor: 2.4.1
  - files_trashbin: 1.2.0
  - files_versions: 1.5.0
  - files_videoplayer: 1.1.0
  - firstrunwizard: 2.1
  - gallery: 17.0.0
  - logreader: 2.0.0
  - lookup_server_connector: 1.0.0
  - nextcloud_announcements: 1.1
  - notifications: 2.0.0
  - oauth2: 1.0.5
  - password_policy: 1.2.2
  - provisioning_api: 1.2.0
  - serverinfo: 1.2.0
  - sharebymail: 1.2.0
  - survey_client: 1.0.0
  - systemtags: 1.2.0
  - theming: 1.3.0
  - twofactor_backupcodes: 1.1.1
  - twofactor_totp: 1.3.1
  - twofactor_u2f: 1.4.0
  - updatenotification: 1.2.0
  - workflowengine: 1.2.0
Disabled:
  - admin_audit
  - files_external
  - user_external
  - user_ldap

The output of your Nextcloud log in Admin > Logging:

Error	no app in context	OC\Encryption\Exceptions\DecryptionFailedException: Encryption module "Default encryption module" is not able to read /admin/files/DSC_0189.JPG
/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Encryption.php - line 328: OCA\Encryption\Crypto\Encryption->isReadable('/admin/files/DS...', NULL)
/var/www/nextcloud/lib/private/Files/Storage/Wrapper/Wrapper.php - line 169: OC\Files\Storage\Wrapper\Encryption->isReadable('files/DSC_0189....')
/var/www/nextcloud/lib/private/Files/View.php - line 1156: OC\Files\Storage\Wrapper\Wrapper->isReadable('files/DSC_0189....')
/var/www/nextcloud/lib/private/Files/View.php - line 512: OC\Files\View->basicOperation('isReadable', '/DSC_0189.JPG')
/var/www/nextcloud/lib/private/Files/Filesystem.php - line 686: OC\Files\View->isReadable('//DSC_0189.JPG')
/var/www/nextcloud/lib/private/legacy/files.php - line 264: OC\Files\Filesystem isReadable('//DSC_0189.JPG')
/var/www/nextcloud/lib/private/legacy/files.php - line 120: OC_Files getSingleFile(Object(OC\Files\View), '/', 'DSC_0189.JPG', Array)
/var/www/nextcloud/apps/files_sharing/lib/Controller/ShareController.php - line 535: OC_Files get('/', 'DSC_0189.JPG', Array)
[internal function] OCA\Files_Sharing\Controller\ShareController->downloadShare('2vJlLiqqoHZm0Jm', NULL, '', '')
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 160: call_user_func_array(Array, Array)
/var/www/nextcloud/lib/private/AppFramework/Http/Dispatcher.php - line 90: OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Files_Sharing\Controller\ShareController), 'downloadShare')
/var/www/nextcloud/lib/private/AppFramework/App.php - line 114: OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Files_Sharing\Controller\ShareController), 'downloadShare')
/var/www/nextcloud/lib/public/AppFramework/App.php - line 136: OC\AppFramework\App main('ShareController', 'downloadShare', Object(OC\AppFramework\DependencyInjection\DIContainer))
/var/www/nextcloud/core/routes.php - line 129: OCP\AppFramework\App->dispatch('ShareController', 'downloadShare')
[internal function] OC\Route\Router->{closure}(Array)
/var/www/nextcloud/lib/private/Route/Router.php - line 299: call_user_func(Object(Closure), Array)
/var/www/nextcloud/lib/base.php - line 1004: OC\Route\Router->match('/s/2vJlLiqqoHZm...')
/var/www/nextcloud/index.php - line 48: OC handleRequest()
{main}

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

$CONFIG = array (
  'instanceid' => ,
  'passwordsalt' => '',
  'secret' => '',
  'trusted_domains' =>
  array (
    0 => '',
  ),
  'datadirectory' => '',
  'overwrite.cli.url' => '',
  'dbtype' => 'mysql',
  'version' => '12.0.4.3',
  'dbname' => '',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => '',
  'dbpassword' => '',
  'installed' => true,
  'mail_smtpmode' => '',
  'mail_smtpauthtype' => '',
  'mail_from_address' => '',
  'mail_domain' => '',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'maintenance' => false,
  'loglevel' => 0,
  'mail_smtpauth' => ,
  'mail_smtphost' => '',
  'mail_smtpport' => '',
  'mail_smtpname' => '',
  'mail_smtppassword' => '',
  'mail_smtpsecure' => '',
);

Hopefully these are all the important Details, if there is something missing let me know.

Thanks for your help in advance

I am having a similar problem.
One of my clients can’t access the file I sent him (simple shared excel sheet)
He gets the same message (also in german by the way, not sure it is linked) I can access the file fine when connected or disconnected…

Does someone have an idea ?

My installation runs on a shared server running Apache with minimal modules installed on top of a stock installation performed by the hoster.

Did you enable server sided encryption and disabled it at some point?
Since when do you have these problems? Im not quite sure right now, i ran a couple of tests sharing and downloding files from my nextcloud and it seems to work for some reason, i’d suggest you to update and upgrade all your packages and do a reboot. I will do some more testing and let you know in case i find something usefull