소스 검색

Properly handle bad URI schemes.

pull/24/head
Ben Kurtovic 11 년 전
부모
커밋
adf6e9c23a
2개의 변경된 파일7개의 추가작업 그리고 0개의 파일을 삭제
  1. +4
    -0
      pages/copyvios.mako
  2. +3
    -0
      toolserver/copyvios/checker.py

+ 4
- 0
pages/copyvios.mako 파일 보기

@@ -10,6 +10,10 @@
<div class="red-box">
<p>The given page doesn't seem to exist: <a href="${page.url}">${page.title | h}</a>.</p>
</div>
% elif query.project and query.lang and query.title and query.url and page and result == "bad URI":
<div class="red-box">
<p>Unsupported URI scheme: <a href="${query.url | h}">${query.url | h}</a>.</p>
</div>
% endif
<h1>Copyvio Detector</h1>
<p>This tool attempts to detect <a href="//en.wikipedia.org/wiki/WP:COPYVIO">copyright violations</a> in articles. Simply give the title of the page you want to check and hit Submit. The tool will then search for its content elsewhere on the web and display a report if a similar webpage is found. If you also provide a URL, it will not query any search engines and instead display a report comparing the article to that particular webpage, like the <a href="//toolserver.org/~dcoetzee/duplicationdetector/">Duplication Detector</a>. Check out the <a href="//en.wikipedia.org/wiki/User:EarwigBot/Copyvios/FAQ">FAQ</a> for more information and technical details.</p>


+ 3
- 0
toolserver/copyvios/checker.py 파일 보기

@@ -2,6 +2,7 @@

from datetime import datetime
from hashlib import sha256
from urlparse import urlparse

from earwigbot import exceptions

@@ -15,6 +16,8 @@ def get_results(bot, site, query):
return page, None

if query.url:
if urlparse(query.url).scheme not in ["http", "https"]:
return page, "bad URI"
result = page.copyvio_compare(query.url)
result.cached = False
else:


불러오는 중...
취소
저장