Modify robot_table machine_uri entry to get rid of filename if present, a=chris

Chris Pollett [2012-07-03 17:32:01]
Modify robot_table machine_uri entry to get rid of filename if present, a=chris
Filename
controllers/fetch_controller.php
diff --git a/controllers/fetch_controller.php b/controllers/fetch_controller.php
index 2e50396..c1ac616 100755
--- a/controllers/fetch_controller.php
+++ b/controllers/fetch_controller.php
@@ -94,8 +94,12 @@ class FetchController extends Controller implements CrawlConstants
             $robot_table = unserialize(file_get_contents($robot_table_name));
         }
         if(isset($_REQUEST['robot_instance'])) {
+            $machine_uri = $this->clean($_REQUEST['machine_uri'], "string");
+            $path_info = pathinfo($machine_uri);
+            $machine_uri = (isset($path_info["dirname"])) ?
+                $path_info["dirname"] : "";
             $robot_table[$this->clean($_REQUEST['robot_instance'], "string")] =
-                array($_SERVER['REMOTE_ADDR'], $_REQUEST['machine_uri'],
+                array($_SERVER['REMOTE_ADDR'], $machine_uri,
                 time());
             file_put_contents($robot_table_name, serialize($robot_table));
         }
ViewGit