diff --git a/server/szurubooru/func/snapshots.py b/server/szurubooru/func/snapshots.py index b6a13e00..946c9ade 100644 --- a/server/szurubooru/func/snapshots.py +++ b/server/szurubooru/func/snapshots.py @@ -29,7 +29,7 @@ def get_post_snapshot(post: model.Post) -> Dict[str, Any]: 'source': post.source, 'safety': post.safety, 'checksum': post.checksum, - 'flags': sorted(post.flags.split(',')), + 'flags': sorted([x for x in post.flags.split(',') if x]), 'featured': post.is_featured, 'tags': sorted([tag.first_name for tag in post.tags]), 'relations': sorted([rel.post_id for rel in post.relations]), diff --git a/server/szurubooru/tests/conftest.py b/server/szurubooru/tests/conftest.py index 27a107aa..c6208c41 100644 --- a/server/szurubooru/tests/conftest.py +++ b/server/szurubooru/tests/conftest.py @@ -202,7 +202,7 @@ def post_factory(skip_post_hashing): post.safety = safety post.type = type post.checksum = checksum - post.flags = [] + post.flags = '' post.mime_type = 'application/octet-stream' post.creation_time = datetime(1996, 1, 1) return post diff --git a/server/szurubooru/tests/func/test_posts.py b/server/szurubooru/tests/func/test_posts.py index d0c27ba6..a79fdf96 100644 --- a/server/szurubooru/tests/func/test_posts.py +++ b/server/szurubooru/tests/func/test_posts.py @@ -112,7 +112,7 @@ def test_serialize_post( post.user = user_factory(name='post author') post.canvas_width = 200 post.canvas_height = 300 - post.flags = ['loop'] + post.flags = 'loop' db.session.add(post) db.session.flush() @@ -654,7 +654,7 @@ def test_update_post_notes_with_invalid_content(input): def test_update_post_flags(): post = model.Post() posts.update_post_flags(post, ['loop']) - assert post.flags == ['loop'] + assert post.flags == 'loop' def test_update_post_flags_with_invalid_content():