summaryrefslogtreecommitdiffstats
path: root/attachment.cgi
diff options
context:
space:
mode:
authorjocuri%softhome.net <>2004-04-11 00:08:21 +0200
committerjocuri%softhome.net <>2004-04-11 00:08:21 +0200
commitb9c3dbad825ee0936d1687aff9fdf122d88d6dac (patch)
treee81f9a900167b74ce8e5dfd6c79b981e337f4f69 /attachment.cgi
parent2cb580b5c21df6924b9fb7b16331421267462b6e (diff)
downloadbugzilla-b9c3dbad825ee0936d1687aff9fdf122d88d6dac.tar.gz
bugzilla-b9c3dbad825ee0936d1687aff9fdf122d88d6dac.tar.xz
Patch for bug 87770: make attachment.cgi work with no parameters; patch by GavinS <bugzilla@chimpychompy.org>; r=kiko; a=myk.
Diffstat (limited to 'attachment.cgi')
-rwxr-xr-xattachment.cgi31
1 files changed, 26 insertions, 5 deletions
diff --git a/attachment.cgi b/attachment.cgi
index 61565f01f..d851e537e 100755
--- a/attachment.cgi
+++ b/attachment.cgi
@@ -68,17 +68,27 @@ my $cgi = Bugzilla->cgi;
# Main Body Execution
################################################################################
-# All calls to this script should contain an "action" variable whose value
-# determines what the user wants to do. The code below checks the value of
-# that variable and runs the appropriate code.
+# All calls to this script should contain an "action" variable whose
+# value determines what the user wants to do. The code below checks
+# the value of that variable and runs the appropriate code. If none is
+# supplied, we default to 'view'.
# Determine whether to use the action specified by the user or the default.
my $action = $::FORM{'action'} || 'view';
+# Slight awkward extra checks for the case when we came here from the
+# attachment/choose.html.tmpl page
+if ($action eq 'View') {
+ $action = 'view';
+}
+elsif ($action eq 'Edit') {
+ $action = 'edit';
+}
+
if ($action eq "view")
-{
+{
validateID();
- view();
+ view();
}
elsif ($action eq "interdiff")
{
@@ -165,6 +175,17 @@ sub validateID
{
my $param = @_ ? $_[0] : 'id';
+ # Only do this check for no 'id' parameter if we are trying to
+ # validate the 'id' parameter
+ if ($param eq 'id' && !$cgi->param('id')) {
+
+ print Bugzilla->cgi->header();
+ $template->process("attachment/choose.html.tmpl", $vars) ||
+ ThrowTemplateError($template->error());
+ exit;
+
+ }
+
# Validate the value of the "id" form field, which must contain an
# integer that is the ID of an existing attachment.