Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve domain whitespace handling in inputs #621

Merged
merged 2 commits into from Dec 7, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/pi-hole/js/list.js
Expand Up @@ -141,7 +141,7 @@ function add(arg) {
$.ajax({
url: "scripts/pi-hole/php/add.php",
method: "post",
data: {"domain":domain.val(), "list":locallistType, "token":token},
data: {"domain":domain.val().trim(), "list":locallistType, "token":token},
success: function(response) {
if (response.indexOf("] Pi-hole blocking is ") === -1) {
alFailure.show();
Expand Down
9 changes: 5 additions & 4 deletions scripts/pi-hole/js/queryads.js
Expand Up @@ -57,9 +57,10 @@ function httpGet(ta,quiet,theUrl)

function eventsource() {
var ta = $("#output");
var domain = $("#domain");
var domain = $("#domain").val().trim();
var q = $("#quiet");
if(domain.val().length === 0)

if(domain.length === 0)
{
return;
}
Expand All @@ -73,12 +74,12 @@ function eventsource() {

// IE does not support EventSource - load whole content at once
if (typeof EventSource !== "function") {
httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+exact+"&IE");
httpGet(ta,quiet,"/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+exact+"&IE");
return;
}

var host = window.location.host;
var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.val().toLowerCase()+"&"+exact);
var source = new EventSource("/admin/scripts/pi-hole/php/queryads.php?domain="+domain.toLowerCase()+"&"+exact);

// Reset and show field
ta.empty();
Expand Down