Kaynağa Gözat

Fix bug when page contains unicode.

pull/24/head
Ben Kurtovic 12 yıl önce
ebeveyn
işleme
859f388ee3
1 değiştirilmiş dosya ile 2 ekleme ve 2 silme
  1. +2
    -2
      toolserver/copyvios/checker.py

+ 2
- 2
toolserver/copyvios/checker.py Dosyayı Görüntüle

@@ -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, ?, ?)"


Yükleniyor…
İptal
Kaydet