commit e80e39021814ecea19048a930fcd5df14b97cce9
parent 77c7140bc76d98f5c1499346c7f2951e8af237f1
Author: René Wagner <apollo@rw-net.de>
Date: Sun, 26 Jan 2020 16:35:50 +0100
lowercase urls on creation and redirect check
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/admin.php b/admin.php
@@ -29,7 +29,7 @@ if (isset($_GET["delete"]) || isset($_GET["add"])) {
unset($config_content["shortlinks"][$data["name"]]);
unset($stats_content[$data["name"]]);
} else if (isset($_GET["add"])) {
- $filtered = array("name" => filter_var($data["name"], FILTER_SANITIZE_STRING),
+ $filtered = array("name" => strtolower(filter_var($data["name"], FILTER_SANITIZE_STRING)),
"url" => filter_var($data["url"], FILTER_SANITIZE_URL));
if (!filter_var($filtered["url"], FILTER_VALIDATE_URL)) {
echo "{\"status\": \"unvalid-url\"}";
diff --git a/redirect.php b/redirect.php
@@ -2,7 +2,7 @@
// All relevant changes can be made in the data file. Please read the docs: https://github.com/flokX/devShort/wiki
-$short = htmlspecialchars($_GET["short"]);
+$short = strtolower(htmlspecialchars($_GET["short"]));
$return_404 = array("favicon.ico", "assets/vendor/bootstrap/bootstrap.min.css.map", "assets/vendor/frappe-charts/frappe-charts.min.iife.js.map");
if (in_array($short, $return_404)) {