summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrédéric Buclin <LpSolit@gmail.com>2011-10-01 13:19:55 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2011-10-01 13:19:55 +0200
commit613d9ce787fd65d6c186bb76716b3e1a48e1521e (patch)
tree3834b2b3f6f8c160cdaee1e304a8734e5327f3f8
parente4f8a784dea705fcc2d29183e5c899e4e6d8d6d1 (diff)
downloadbugzilla-613d9ce787fd65d6c186bb76716b3e1a48e1521e.tar.gz
bugzilla-613d9ce787fd65d6c186bb76716b3e1a48e1521e.tar.xz
Bug 582529: Ambiguous error message "You did not specify a file to attach" when deleting an existing attachment filename
a=LpSolit
-rw-r--r--Bugzilla/Attachment.pm9
-rw-r--r--template/en/default/global/user-error.html.tmpl4
2 files changed, 12 insertions, 1 deletions
diff --git a/Bugzilla/Attachment.pm b/Bugzilla/Attachment.pm
index a39dc3af4..3a8e7d5d5 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 7dac2ee55..d36f27d91 100644
--- a/template/en/default/global/user-error.html.tmpl
+++ b/template/en/default/global/user-error.html.tmpl
@@ -604,6 +604,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 %]