From c288c09e6095654d49cefbb789879f455535417c Mon Sep 17 00:00:00 2001 From: Aevann1 Date: Wed, 19 Jan 2022 17:35:08 +0200 Subject: [PATCH] dfs --- files/routes/settings.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/files/routes/settings.py b/files/routes/settings.py index 427e3fe1b..d81b5b955 100644 --- a/files/routes/settings.py +++ b/files/routes/settings.py @@ -857,7 +857,7 @@ def settings_name_change(v): v=v, error=f"Username `{new_name}` is already in use.") - v=g.db.query(User).with_for_update().filter_by(id=v.id).one_or_none() + v=g.db.query(User).filter_by(id=v.id).one_or_none() v.username=new_name v.name_changed_utc=int(time.time()) @@ -876,8 +876,9 @@ def settings_name_change(v): def settings_song_change(v): song=request.values.get("song").strip() - if song == "" and v.song and path.isfile(f"/songs/{v.song}.mp3") and g.db.query(User.id).filter_by(song=v.song).count() == 1: - os.remove(f"/songs/{v.song}.mp3") + if song == "" and v.song: + if path.isfile(f"/songs/{v.song}.mp3") and g.db.query(User.id).filter_by(song=v.song).count() == 1: + os.remove(f"/songs/{v.song}.mp3") v.song = None g.db.add(v) g.db.commit()