avoid .files/smime-pubkey.crt file does not exist or can not be created!

This commit is contained in:
Ralf Becker 2018-08-27 15:30:47 +02:00
parent 77503e3b89
commit 7ca4b49878

View File

@ -346,7 +346,8 @@ class addressbook_bo extends Api\Contacts
$file = Api\Contacts::FILES_SMIME_PUBKEY; $file = Api\Contacts::FILES_SMIME_PUBKEY;
} }
$matches = null; $matches = null;
if (($content = @file_get_contents(Api\Link::vfs_path('addressbook', $contact['id'], $file))) && if (file_exists($path = Api\Link::vfs_path('addressbook', $contact['id'], $file)) &&
($content = file_get_contents($path)) &&
preg_match($key_regexp, $content, $matches) || preg_match($key_regexp, $content, $matches) ||
preg_match($key_regexp, $contact['pubkey'], $matches)) preg_match($key_regexp, $contact['pubkey'], $matches))
{ {