瀏覽代碼

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

pull/24/head
Ben Kurtovic 10 年之前
父節點
當前提交
ca09caa15d
共有 2 個文件被更改,包括 9 次插入1 次删除
  1. +5
    -1
      copyvios/checker.py
  2. +4
    -0
      templates/index.mako

+ 5
- 1
copyvios/checker.py 查看文件

@@ -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 查看文件

@@ -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>


Loading…
取消
儲存