Skip to content

Commit

Permalink
Merge pull request #434 from blocklistproject/issue401
Browse files Browse the repository at this point in the history
Adding lint rule to disallow whitespace in urls
  • Loading branch information
blocklistproject committed Jul 30, 2021
2 parents 1c8b62f + 590203d commit cbf5e43
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions scripts/lint.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ const path = require("path");
hasError = true;
}
}

// Ensure that the URL doesn't contain whitespace characters
if (line.startsWith("0.0.0.0 ")) {
const lineNoIP = line.replace("0.0.0.0 ", "");
const url = lineNoIP.split("#")[0].trim();
if (/\s/gmu.test(url)) {
console.error(`Line ${index + 1} in ${file} url ${url} contains whitespace in the URL.`);
hasError = true;
}
}
});
}));

Expand Down

0 comments on commit cbf5e43

Please sign in to comment.