From 3d3fb25d78295afd5eb572c427c92da252570cc0 Mon Sep 17 00:00:00 2001 From: "Antonio J. Delgado" Date: Thu, 26 Jan 2023 10:44:27 +0200 Subject: [PATCH] escape file --- find_duplicate_files/find_duplicate_files.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/find_duplicate_files/find_duplicate_files.py b/find_duplicate_files/find_duplicate_files.py index 301f787..cdc528f 100644 --- a/find_duplicate_files/find_duplicate_files.py +++ b/find_duplicate_files/find_duplicate_files.py @@ -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]