From 01d27e22f8a5eb7732f27fdd4549ee39c6963571 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Tue, 19 Jul 2016 11:49:00 +0100 Subject: [PATCH] [#2855] [WebUI] Unable to add UDP trackers --- deluge/ui/web/js/deluge-all/AddTrackerWindow.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/deluge/ui/web/js/deluge-all/AddTrackerWindow.js b/deluge/ui/web/js/deluge-all/AddTrackerWindow.js index 9ac26a31c..d0ea0a062 100644 --- a/deluge/ui/web/js/deluge-all/AddTrackerWindow.js +++ b/deluge/ui/web/js/deluge-all/AddTrackerWindow.js @@ -9,6 +9,15 @@ */ Ext.ns('Deluge'); +// Custom VType validator for tracker urls +var trackerUrlTest = /(((^https?)|(^udp)):\/\/([\-\w]+\.)+\w{2,3}(\/[%\-\w]+(\.\w{2,})?)*(([\w\-\.\?\\\/+@&#;`~=%!]*)(\.\w{2,})?)*\/?)/i; +Ext.apply(Ext.form.VTypes, { + trackerUrl: function(val, field) { + return trackerUrlTest.test(val); + }, + trackerUrlText: 'Not a valid tracker url' +}); + /** * @class Deluge.AddTrackerWindow * @extends Ext.Window @@ -55,7 +64,7 @@ Deluge.AddTrackerWindow = Ext.extend(Ext.Window, { var cleaned = []; Ext.each(trackers, function(tracker) { - if (Ext.form.VTypes.url(tracker)) { + if (Ext.form.VTypes.trackerUrl(tracker)) { cleaned.push(tracker); } }, this);