commit fedf6519d0518134d1789a0de942dee2f864e147
parent c5ed48151bbbdf7efa6f6ac937721e08b5b24dbb
Author: René Wagner <rwagner@rw-net.de>
Date: Mon, 13 Jan 2020 20:06:17 +0100
Case insensitive urls (#1)
* lowercase shortname to be case-insensitive
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/admin.php b/admin.php
@@ -36,7 +36,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_name($data["name"]),
+ $filtered = array("name" => strtolower(filter_name($data["name"])),
"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)) {