]> littlesong.place Git - littlesongplace.git/commitdiff
Fix issue with tags being converted to lowercase
authorChris Fulljames <christianfulljames@gmail.com>
Sat, 1 Feb 2025 21:11:01 +0000 (16:11 -0500)
committerChris Fulljames <christianfulljames@gmail.com>
Sat, 1 Feb 2025 21:11:01 +0000 (16:11 -0500)
main.py
test/test_offline.py

diff --git a/main.py b/main.py
index 5fe09554307f676278d1b9070d0cc71b50140708..a8ff87887b4fabc0965f82efd886b54c08ff8e4c 100644 (file)
--- a/main.py
+++ b/main.py
@@ -283,7 +283,7 @@ def update_song():
     file = request.files["song"]
     title = request.form["title"]
     description = request.form["description"]
-    tags = [t.strip().lower() for t in request.form["tags"].split(",")]
+    tags = [t.strip() for t in request.form["tags"].split(",")]
     collaborators = [c.strip() for c in request.form["collabs"].split(",")]
 
     # Make sure song exists and the logged-in user owns it
index 097a5885835d36855cb50e1e9e612928c2f5e58a..cc2f1e585268cc0b794168e348db573d128ca45a 100644 (file)
@@ -354,6 +354,26 @@ def test_update_song_other_users_song(client):
     response = client.post(f"/upload-song?songid=1", data=data)
     assert response.status_code == 401
 
+def test_uppercase_tags(client):
+    _create_user(client, "user", "password", login=True)
+    _test_upload_song(client, b"Success", tags="TAG1, tag2")
+    response = client.get("/users/user")
+
+    # Both tag versions present
+    assert b"TAG1" in response.data
+    assert b"tag2" in response.data
+
+    # Edit song
+    _test_upload_song(client, b"Success", tags="T1, t2", songid=1)
+
+    # Uppercase tags still work
+    response = client.get("/users/user")
+    assert b"TAG1" not in response.data
+    assert b"T1" in response.data
+
+    assert b"tag2" not in response.data
+    assert b"t2" in response.data
+
 ################################################################################
 # Delete Song
 ################################################################################