fixed search errors

This commit is contained in:
Kristy Fournier 2026-01-26 15:32:00 -05:00
parent bcf3f28cb0
commit 7d45d9498e
2 changed files with 7 additions and 4 deletions

View file

@ -1,4 +1,4 @@
/* testing */ /* dark mode stuff */
.dark-mode { .dark-mode {
--bg-main: #333333; --bg-main: #333333;
@ -37,8 +37,9 @@ input, button {
body { body {
background-color: var(--bg-main); background-color: var(--bg-main);
} }
* { * {
font-family: 'arial'; font-family: 'Work Sans','Arial',sans-serif;
} }
.italic { .italic {

View file

@ -180,11 +180,12 @@ def searchSongDB():
songDatabase = fileofDB.cursor() songDatabase = fileofDB.cursor()
try: try:
results = [] results = []
# print(recieveData["search"])
if (recieveData['search'] == ""): if (recieveData['search'] == ""):
songDatabase.execute("SELECT * FROM virtualSongs") songDatabase.execute("SELECT * FROM virtualSongs")
results = songDatabase.fetchall() results = songDatabase.fetchall()
else: else:
songDatabase.execute("SELECT * FROM virtualSongs WHERE virtualSongs MATCH ?",[recieveData['search']]) songDatabase.execute("SELECT * FROM virtualSongs WHERE virtualSongs MATCH ?",['"' + recieveData['search']+'"'])
results = songDatabase.fetchall() results = songDatabase.fetchall()
tempdata = {} tempdata = {}
# this is a temporary solution so i dont have to change the client # this is a temporary solution so i dont have to change the client
@ -202,7 +203,8 @@ def searchSongDB():
except KeyError: except KeyError:
fileofDB.close() fileofDB.close()
return ERR_MISSING_ARGS return ERR_MISSING_ARGS
except sql.OperationalError: except sql.OperationalError as e:
print(e)
fileofDB.close() fileofDB.close()
return ({"error":"Invalid search, sorry!","data":None},422) return ({"error":"Invalid search, sorry!","data":None},422)