diff options
author | Phie <phie@phie.ovh> | 2019-08-17 18:03:54 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-08-17 18:03:54 +0300 |
commit | b0c8de086f72791512b4776dc03eda46834c6750 (patch) | |
tree | 315f6d13c961ce55b0b026509a6cfcb2a5141501 | |
parent | ef547dded8e7216c8c63b58a28abc227a8dff6e8 (diff) |
don't crash when no metadata file
-rwxr-xr-x | lib/Controller/NoteController.php | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index 9df37ae..006ef61 100755 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -843,7 +843,9 @@ file_put_contents($tmppath,$this->CarnetFolder->get($path)->fopen("r")); $zipFile = new MyZipFile(); $zipFile->openFile($tmppath); - $data['metadata'] = json_decode($zipFile['metadata.json']); + try{ + $data['metadata'] = json_decode($zipFile['metadata.json']); + } catch(\PhpZip\Exception\ZipNotFoundEntry $e){} $data['html'] = $zipFile['index.html']; unlink($tmppath); shell_exec('php occ carnet:opennote '.escapeshellarg($this->userId).' '.escapeshellarg($path).' '.escapeshellarg($editUniqueID).'> /dev/null 2>/dev/null &'); |