From 2f68266fde390b34e4fb7920bf754d0850551f36 Mon Sep 17 00:00:00 2001
From: Kubat <mael.martin31@gmail.com>
Date: Sun, 17 Jan 2021 21:40:20 +0100
Subject: [PATCH] MODULE: Favorite import working

---
 inc/lektor/config.def    | 2 +-
 src/base/json.c          | 4 +---
 src/module/module_repo.c | 4 ++--
 3 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/inc/lektor/config.def b/inc/lektor/config.def
index 5756920f..597a2581 100644
--- a/inc/lektor/config.def
+++ b/inc/lektor/config.def
@@ -1,4 +1,4 @@
-value_opt("log", "WARN") /* Can be DEBUG, INFO, WARN, ERROR */
+value_opt("log", "INFO") /* Can be DEBUG, INFO, WARN, ERROR */
 
 section("externals")
 value("mkvpropedit",    "/usr/bin/mkvpropedit")
diff --git a/src/base/json.c b/src/base/json.c
index 1721faa3..037bc319 100644
--- a/src/base/json.c
+++ b/src/base/json.c
@@ -118,10 +118,8 @@ json_parse(const char *str, int asked_level, json_parse_callback call, void *use
 
         /* End of a block */
         else if ((len = strspn(str, __JSON_END))) {
-            if (level == asked_level) {
-                LOG_DEBUG("JSON", "Completion call for json object");
+            if (level == asked_level)
                 call(NULL, NULL, 1, user);
-            }
             str    += len;
             level  -= len;
         }
diff --git a/src/module/module_repo.c b/src/module/module_repo.c
index e3e254bf..32226168 100644
--- a/src/module/module_repo.c
+++ b/src/module/module_repo.c
@@ -519,7 +519,7 @@ end_no_lock:
 static void
 __handle_fav_list_internal(const char UNUSED *key, const char *val, int UNUSED comp, void *user)
 {
-    if (val)
+    if (val == NULL)
         return;
 
     struct __uri *uri = (struct __uri *) user;
@@ -567,7 +567,7 @@ __handle_fav_list(struct module_repo_internal *repo, char *fav, size_t fav_size)
         },
     };
 
-    json_parse(json, 1, __handle_fav_list_internal, (void *) &uri);
+    json_parse(json, 2, __handle_fav_list_internal, (void *) &uri);
     LOG_INFO("REPO", "Finished importing fav list '%s' as '%s'", fav_origin, fav);
     free(json);
 }
-- 
GitLab