From: Frédéric Buclin Date: Sat, 1 Oct 2011 11:22:13 +0000 (+0200) Subject: Bug 582529: Ambiguous error message "You did not specify a file to attach" when delet... X-Git-Tag: bugzilla-4.2rc1~55 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=898e5ab5f292d8d0d72ae0aa9fc6d4638e5d6eca;p=thirdparty%2Fbugzilla.git Bug 582529: Ambiguous error message "You did not specify a file to attach" when deleting an existing attachment filename a=LpSolit --- diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm index a39dc3af41..3a8e7d5d5f 100644 --- a/Bugzilla/Attachment.pm +++ b/Bugzilla/Attachment.pm @@ -565,7 +565,14 @@ sub _check_filename { my ($invocant, $filename) = @_; $filename = clean_text($filename); - $filename || ThrowUserError('file_not_specified'); + if (!$filename) { + if (ref $invocant) { + ThrowUserError('filename_not_specified'); + } + else { + ThrowUserError('file_not_specified'); + } + } # Remove path info (if any) from the file name. The browser should do this # for us, but some are buggy. This may not work on Mac file names and could diff --git a/template/en/default/global/user-error.html.tmpl b/template/en/default/global/user-error.html.tmpl index 35640b220b..265a061d10 100644 --- a/template/en/default/global/user-error.html.tmpl +++ b/template/en/default/global/user-error.html.tmpl @@ -599,6 +599,10 @@ [% title = "No File Specified" %] You did not specify a file to attach. + [% ELSIF error == "filename_not_specified" %] + [% title = "No Filename Specified" %] + You must specify a filename for this attachment. + [% ELSIF error == "file_too_large" %] [% title = "File Too Large" %] [%# Convert maxlocalattachment from Mb to Kb %]