From 561c2106ce636c94eb21435307dfadd7eef4bb84 Mon Sep 17 00:00:00 2001 From: vabene1111 Date: Sun, 27 Feb 2022 11:27:23 +0100 Subject: [PATCH] fixed nextcloud import first item --- cookbook/provider/nextcloud.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/cookbook/provider/nextcloud.py b/cookbook/provider/nextcloud.py index b1d319193..e7b100dfd 100644 --- a/cookbook/provider/nextcloud.py +++ b/cookbook/provider/nextcloud.py @@ -9,6 +9,8 @@ from cookbook.models import Recipe, RecipeImport, SyncLog from cookbook.provider.provider import Provider from requests.auth import HTTPBasicAuth +from recipes.settings import DEBUG + class Nextcloud(Provider): @@ -28,15 +30,18 @@ class Nextcloud(Provider): def import_all(monitor): client = Nextcloud.get_client(monitor.storage) + if DEBUG: + print(f'TANDOOR_PROVIDER_DEBUG checking path {monitor.path} with client {client}') + files = client.list(monitor.path) - try: - files.pop(0) # remove first element because its the folder itself - except IndexError: - pass # folder is empty, no recipes will be imported + if DEBUG: + print(f'TANDOOR_PROVIDER_DEBUG file list {files}') import_count = 0 for file in files: + if DEBUG: + print(f'TANDOOR_PROVIDER_DEBUG importing file {file}') path = monitor.path + '/' + file if not Recipe.objects.filter(file_path__iexact=path, space=monitor.space).exists() and not RecipeImport.objects.filter(file_path=path, space=monitor.space).exists(): name = os.path.splitext(file)[0]