[Midnightbsd-cvs] mports [19543] trunk/Tools/magus/www/data/magus/index.cgi: add 404 errors for the ports list page

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Jun 25 18:55:22 EDT 2015


Revision: 19543
          http://svnweb.midnightbsd.org/mports/?rev=19543
Author:   laffer1
Date:     2015-06-25 18:55:21 -0400 (Thu, 25 Jun 2015)
Log Message:
-----------
add 404 errors for the ports list page

Modified Paths:
--------------
    trunk/Tools/magus/www/data/magus/index.cgi

Modified: trunk/Tools/magus/www/data/magus/index.cgi
===================================================================
--- trunk/Tools/magus/www/data/magus/index.cgi	2015-06-25 12:31:28 UTC (rev 19542)
+++ trunk/Tools/magus/www/data/magus/index.cgi	2015-06-25 22:55:21 UTC (rev 19543)
@@ -70,7 +70,11 @@
   } elsif ($path =~m:^/compare/:) {
     compare_runs($p);
   } else {
-    die "Unknown path: $path\n";
+    print $p->header(
+              -type=>'text/plain',
+              -status=> '404 Not Found'
+    );
+    print "Unknown path: $path\n";
   }
 }
 
@@ -223,9 +227,18 @@
   my ($p, $port) = @_;
   
   my $tmpl = template($p, "port.tmpl");
-  
-  $port = Magus::Port->retrieve($port) || die "No such port: $port";
- 
+
+  eval { 
+      $port = Magus::Port->retrieve($port) || die "No such port: $port";
+  };
+  if ($@) {
+      print $p->header(
+              -type=>'text/plain',
+              -status=> '404 Not Found'
+    );
+    exit;
+  }
+
   $tmpl->param(
     port      => $port->name, 
     id        => $port->id,



More information about the Midnightbsd-cvs mailing list