fix: [Paste submit] fix tags unpack

This commit is contained in:
Terrtia 2019-12-02 17:15:48 +01:00
parent 9898766ed7
commit 2cf419fc26
No known key found for this signature in database
GPG key ID: 1E1B1F50D84613D0
2 changed files with 7 additions and 7 deletions

View file

@ -159,7 +159,10 @@ def get_item_tags_minimal(item_id):
def unpack_str_tags_list(str_tags_list): def unpack_str_tags_list(str_tags_list):
str_tags_list = str_tags_list.replace('"','\"') 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 # TEMPLATE + API QUERY

View file

@ -258,13 +258,10 @@ def submit():
if ltags or ltagsgalaxies: if ltags or ltagsgalaxies:
ltags = ltags.split(',') ltags = Tag.unpack_str_tags_list(ltags)
ltagsgalaxies = ltagsgalaxies.split(',') ltagsgalaxies = Tag.unpack_str_tags_list(ltagsgalaxies)
print(ltags) if not Tag.is_valid_tags_taxonomies_galaxy(ltags, ltagsgalaxies):
print(ltagsgalaxies)
if not Tags.is_valid_tags_taxonomies_galaxy(ltags, ltagsgalaxies):
content = 'INVALID TAGS' content = 'INVALID TAGS'
print(content) print(content)
return content, 400 return content, 400