From 2cf419fc26fd8381ddded048935d7f80bf192d7b Mon Sep 17 00:00:00 2001 From: Terrtia Date: Mon, 2 Dec 2019 17:15:48 +0100 Subject: [PATCH] fix: [Paste submit] fix tags unpack --- bin/packages/Tag.py | 5 ++++- var/www/modules/PasteSubmit/Flask_PasteSubmit.py | 9 +++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/packages/Tag.py b/bin/packages/Tag.py index 62a9b95f..d523bb9e 100755 --- a/bin/packages/Tag.py +++ b/bin/packages/Tag.py @@ -159,7 +159,10 @@ def get_item_tags_minimal(item_id): def unpack_str_tags_list(str_tags_list): str_tags_list = str_tags_list.replace('"','\"') - return str_tags_list.split(',') + if str_tags_list: + return str_tags_list.split(',') + else: + return [] # TEMPLATE + API QUERY diff --git a/var/www/modules/PasteSubmit/Flask_PasteSubmit.py b/var/www/modules/PasteSubmit/Flask_PasteSubmit.py index 4af8fa0b..420e0bdf 100644 --- a/var/www/modules/PasteSubmit/Flask_PasteSubmit.py +++ b/var/www/modules/PasteSubmit/Flask_PasteSubmit.py @@ -258,13 +258,10 @@ def submit(): if ltags or ltagsgalaxies: - ltags = ltags.split(',') - ltagsgalaxies = ltagsgalaxies.split(',') + ltags = Tag.unpack_str_tags_list(ltags) + ltagsgalaxies = Tag.unpack_str_tags_list(ltagsgalaxies) - print(ltags) - print(ltagsgalaxies) - - if not Tags.is_valid_tags_taxonomies_galaxy(ltags, ltagsgalaxies): + if not Tag.is_valid_tags_taxonomies_galaxy(ltags, ltagsgalaxies): content = 'INVALID TAGS' print(content) return content, 400