From adf6e9c23ab9b665b598a9624ae9825b4fa45113 Mon Sep 17 00:00:00 2001 From: Ben Kurtovic Date: Tue, 4 Sep 2012 22:41:17 -0400 Subject: [PATCH] Properly handle bad URI schemes. --- pages/copyvios.mako | 4 ++++ toolserver/copyvios/checker.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/pages/copyvios.mako b/pages/copyvios.mako index 0ec5c98..0a91c1b 100644 --- a/pages/copyvios.mako +++ b/pages/copyvios.mako @@ -10,6 +10,10 @@

The given page doesn't seem to exist: ${page.title | h}.

+ % elif query.project and query.lang and query.title and query.url and page and result == "bad URI": +
+

Unsupported URI scheme: ${query.url | h}.

+
% endif

Copyvio Detector

This tool attempts to detect copyright violations 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 Duplication Detector. Check out the FAQ for more information and technical details.

diff --git a/toolserver/copyvios/checker.py b/toolserver/copyvios/checker.py index b82ea4e..ca05651 100644 --- a/toolserver/copyvios/checker.py +++ b/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: