From ff0ff0364a06bb136d9ad6dbed53ccae89357e50 Mon Sep 17 00:00:00 2001 From: Alex Dedul Date: Sun, 15 Jul 2007 02:36:09 +0000 Subject: [PATCH] Show text from clipboard in Add URL dialog only if it looks like an URL. --- src/interface.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/interface.py b/src/interface.py index eb26acc51..3b755d7e9 100644 --- a/src/interface.py +++ b/src/interface.py @@ -32,6 +32,7 @@ import os.path from itertools import izip +import re import urllib import gettext @@ -1177,9 +1178,10 @@ class DelugeGTK: dlg.vbox.pack_start(entry) clip = gtk.clipboard_get(selection='PRIMARY') text = clip.wait_for_text() - #watch out for an empty clipboard, TODO check for non url garbage if text: - entry.set_text(text) + text = text.strip() + if re.search('^(https?|ftp)://', text): + entry.set_text(text) dlg.show_all() result = dlg.run() url = entry.get_text()