Quellcode durchsuchen

Give an error when no text could be found inside a URL.

pull/24/head
Ben Kurtovic vor 10 Jahren
Ursprung
Commit
ca09caa15d
2 geänderte Dateien mit 9 neuen und 1 gelöschten Zeilen
  1. +5
    -1
      copyvios/checker.py
  2. +4
    -0
      templates/index.mako

+ 5
- 1
copyvios/checker.py Datei anzeigen

@@ -41,7 +41,11 @@ def _get_results(query):
if urlparse(query.url).scheme not in ["http", "https"]:
query.error = "bad URI"
return
query.result = page.copyvio_compare(query.url)
result = page.copyvio_compare(query.url)
if result.source_chain is page.EMPTY:
query.error = "no data"
return
query.result = result
query.result.cached = False
else:
conn = get_cache_db()


+ 4
- 0
templates/index.mako Datei anzeigen

@@ -7,6 +7,10 @@
<div id="info-box" class="red-box">
<p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
</div>
% elif query.error == "no data":
<div id="info-box" class="red-box">
<p>Couldn't find any text in <a href="${query.url | h}">${query.url | h}</a>. <i>Note:</i> only HTML and plain text pages are supported, and content generated by JavaScript or found inside iframes is ignored.</p>
</div>
% elif not query.site:
<div id="info-box" class="red-box">
<p>The given site (project=<b><span class="mono">${query.project | h}</span></b>, language=<b><span class="mono">${query.lang | h}</span></b>) doesn't seem to exist. It may also be closed or private. <a href="//${query.lang | h}.${query.project | h}.org/">Confirm its URL.</a></p>


Laden…
Abbrechen
Speichern