decode bytes
This commit is contained in:
parent
b6f9479bf7
commit
75fcbbcbda
1 changed files with 4 additions and 0 deletions
|
@ -61,6 +61,8 @@ class find_duplicate_files:
|
||||||
def _check_file_cache(self, file):
|
def _check_file_cache(self, file):
|
||||||
file_sql = file.replace("'", "''")
|
file_sql = file.replace("'", "''")
|
||||||
query = f"SELECT hash FROM files WHERE file = '{file_sql}'"
|
query = f"SELECT hash FROM files WHERE file = '{file_sql}'"
|
||||||
|
if isinstance(query, bytes):
|
||||||
|
query = query.decode('utf-8')
|
||||||
try:
|
try:
|
||||||
result = self.cur.execute(query)
|
result = self.cur.execute(query)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
@ -75,6 +77,8 @@ class find_duplicate_files:
|
||||||
def _cache_file(self, file, hash):
|
def _cache_file(self, file, hash):
|
||||||
file_sql = file.replace("'", "''")
|
file_sql = file.replace("'", "''")
|
||||||
query = f"INSERT INTO files (hash, file) VALUES ('{file_sql}', '{hash}')"
|
query = f"INSERT INTO files (hash, file) VALUES ('{file_sql}', '{hash}')"
|
||||||
|
if isinstance(query, bytes):
|
||||||
|
query = query.decode('utf-8')
|
||||||
try:
|
try:
|
||||||
result = self.cur.execute(query)
|
result = self.cur.execute(query)
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
|
|
Loading…
Reference in a new issue