escape file

This commit is contained in:
Antonio J. Delgado 2023-01-26 10:44:27 +02:00
parent 51517f5212
commit 3d3fb25d78

View file

@ -59,7 +59,8 @@ class find_duplicate_files:
self.cache_db.commit()
def _check_file_cache(self, file):
result = self.cur.execute(f"SELECT hash FROM files WHERE file = '{file}'")
file_sql = file.replace("'", "\'")
result = self.cur.execute(f"SELECT hash FROM files WHERE file = '{file_sql}'")
row = result.fetchone()
if row and len(row) > 0:
return row[0]