Parcourir la source

Fix bug when page contains unicode.

pull/24/head
Ben Kurtovic il y a 12 ans
Parent
révision
859f388ee3
1 fichiers modifiés avec 2 ajouts et 2 suppressions
  1. +2
    -2
      toolserver/copyvios/checker.py

+ 2
- 2
toolserver/copyvios/checker.py Voir le fichier

@@ -34,7 +34,7 @@ def get_results(bot, site, query):
def _get_cached_results(page, conn):
query1 = "DELETE FROM cache WHERE cache_time < DATE_SUB(CURRENT_TIMESTAMP, INTERVAL 3 DAY)"
query2 = "SELECT cache_url, cache_time, cache_queries, cache_process_time FROM cache WHERE cache_id = ? AND cache_hash = ?"
shahash = sha256(page.get()).hexdigest()
shahash = sha256(page.get().encode("utf8")).hexdigest()

with conn.cursor() as cursor:
cursor.execute(query1)
@@ -62,7 +62,7 @@ def _format_date(cache_time):

def _cache_result(page, result, conn):
pageid = page.pageid
shahash = sha256(page.get()).hexdigest()
shahash = sha256(page.get().encode("utf8")).hexdigest()
query1 = "SELECT 1 FROM cache WHERE cache_id = ?"
query2 = "DELETE FROM cache WHERE cache_id = ?"
query3 = "INSERT INTO cache VALUES (?, ?, ?, CURRENT_TIMESTAMP, ?, ?)"


Chargement…
Annuler
Enregistrer