Fix queue deletion for The_legend_of_ice_soul
[stouyapi.git] / www / api / v1 / queued_downloads_delete.php
index 3861f93f060187d5bd563082aea65c64cabacd7c..6517adca2be082884f758a4f6585218d09961216 100644 (file)
@@ -12,15 +12,16 @@ $apiGameDir = __DIR__ . '/details-data/';
 require_once __DIR__ . '/../../../src/push-to-my-ouya-helpers.php';
 
 $ip = $_SERVER['REMOTE_ADDR'];
-if ($ip == '' || strpos($ip, ':') !== false) {
-    //empty or IPv6
+if ($ip == '') {
+    //empty ip
+    header('X-Fail-Reason: empty ip address');
     header('HTTP/1.0 204 No Content');
     exit(1);
 }
 $ip = mapIp($ip);
 
 $game = $_GET['game'];
-$cleanGame = preg_replace('#[^a-zA-Z0-9.]#', '', $game);
+$cleanGame = preg_replace('#[^a-zA-Z0-9._]#', '', $game);
 if ($game != $cleanGame || $game == '') {
     header('HTTP/1.0 400 Bad Request');
     header('Content-type: text/plain');
@@ -32,6 +33,7 @@ try {
     $db = new SQLite3($dbFile, SQLITE3_OPEN_READWRITE);
 } catch (Exception $e) {
     //db file not found
+    header('X-Fail-Reason: database file not found');
     header('HTTP/1.0 204 No Content');
     exit(1);
 }