Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/CarnetApp/CarnetNextcloud.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominique Fournier <dominique.fournier@grenoble.cnrs.fr>2020-09-10 14:23:24 +0300
committerDominique Fournier <dominique.fournier@grenoble.cnrs.fr>2020-09-10 14:23:24 +0300
commit750edc9dc168f12278eb9da4782463d872ec980a (patch)
tree7316ad77a1d408afd090f6e924de1e820589625f
parentb503f10846f9dd72506cdc07389fab01ff0c2c45 (diff)
search : if there is no metadata, do not generate an error log : "Invalid argument supplied for foreach() at /var/www/html/nextcloud/apps/carnet/lib/Misc/Search.php#135",
-rw-r--r--lib/Misc/Search.php13
1 files changed, 8 insertions, 5 deletions
diff --git a/lib/Misc/Search.php b/lib/Misc/Search.php
index 74de4e3..cdcf303 100644
--- a/lib/Misc/Search.php
+++ b/lib/Misc/Search.php
@@ -132,11 +132,14 @@ private function search($relativePath, $folder, $query, $curDepth){
try {
$metadata = json_decode($zipFile->getEntryContents("metadata.json"));
$hasFound = false;
- foreach($metadata->keywords as $keyword){
- if(strstr($this->removeAccents(strtolower($keyword)), $query)){
- $this->writeFound($relativePath,$in);
- $hasFound = true;
- break;
+ if (is_object ($metadata))
+ {
+ foreach($metadata->keywords as $keyword){
+ if(strstr($this->removeAccents(strtolower($keyword)), $query)){
+ $this->writeFound($relativePath,$in);
+ $hasFound = true;
+ break;
+ }
}
}
if($hasFound){