From 1df16623401b040d40a44f02a1a185d2565a9b99 Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Mon, 1 Sep 2014 19:17:43 -0700 Subject: [PATCH] *.cgi: improve "not found that's really wierd" error The error can only happen if a project exists as a directory on the disk but does not have a corresponding entry in the jail's etc/group file. Keep the same obscure error message, but instead of using die to display it, format it as an HTML

element so it's not quite so unfriendly to users. --- cgi/delproj.cgi | 5 ++++- cgi/editproj.cgi | 5 ++++- cgi/mirrorproj.cgi | 5 ++++- cgi/pwproj.cgi | 5 ++++- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cgi/delproj.cgi b/cgi/delproj.cgi index 3ecc6d0..3e729cc 100755 --- a/cgi/delproj.cgi +++ b/cgi/delproj.cgi @@ -32,7 +32,10 @@ if (!Girocco::Project::does_exist($name,1)) { } my $proj = Girocco::Project->load($name); -$proj or die "not found project $name, that's really weird!"; +if (!$proj) { + print "

not found project $name, that's really weird!

\n"; + exit; +} my $escname = $name; $escname =~ s/[+]/%2B/g; $proj->{cpwd} = $cgi->param('cpwd'); diff --git a/cgi/editproj.cgi b/cgi/editproj.cgi index 25d72ac..ca06253 100755 --- a/cgi/editproj.cgi +++ b/cgi/editproj.cgi @@ -49,7 +49,10 @@ if (!Girocco::Project::does_exist($name,1)) { } my $proj = Girocco::Project->load($name); -$proj or die "not found project $name, that's really weird!"; +if (!$proj) { + print "

not found project $name, that's really weird!

\n"; + exit; +} my $escname = $name; $escname =~ s/[+]/%2B/g; diff --git a/cgi/mirrorproj.cgi b/cgi/mirrorproj.cgi index 39866e3..780343d 100755 --- a/cgi/mirrorproj.cgi +++ b/cgi/mirrorproj.cgi @@ -33,7 +33,10 @@ if (!Girocco::Project::does_exist($name,1)) { } my $proj = Girocco::Project->load($name); -$proj or die "not found project $name, that's really weird!"; +if (!$proj) { + print "

not found project $name, that's really weird!

\n"; + exit; +} my $escname = $name; $escname =~ s/[+]/%2B/g; diff --git a/cgi/pwproj.cgi b/cgi/pwproj.cgi index 2145e58..70eb888 100755 --- a/cgi/pwproj.cgi +++ b/cgi/pwproj.cgi @@ -38,7 +38,10 @@ if (!Girocco::Project::does_exist($name,1)) { } my $proj = Girocco::Project->load($name); -$proj or die "not found project $name, that's really weird!"; +if (!$proj) { + print "

not found project $name, that's really weird!

\n"; + exit; +} my $escname = $name; $escname =~ s/[+]/%2B/g; -- 2.11.4.GIT