diff --git a/app/views/attachments/_form.html.erb b/app/views/attachments/_form.html.erb
index 7eea17bb7..dd55fa3f1 100644
--- a/app/views/attachments/_form.html.erb
+++ b/app/views/attachments/_form.html.erb
@@ -10,7 +10,7 @@
<%= file_field_tag 'attachments[1][file]', :size => 30, :id => nil, :class => 'file',
:onchange => "checkFileSize(this, #{Setting.attachment_max_size.to_i.kilobytes}, '#{escape_javascript(l(:error_attachment_too_big, :max_size => number_to_human_size(Setting.attachment_max_size.to_i.kilobytes)))}');" -%>
- <%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :placeholder => l(:label_optional_description) %>
+ <%= text_field_tag 'attachments[1][description]', '', :id => nil, :class => 'description', :maxlength => 255, :placeholder => l(:label_optional_description) %>
<%= link_to_function(image_tag('delete.png'), 'removeFileField(this)', :title => (l(:button_delete))) %>
diff --git a/test/functional/issues_controller_test.rb b/test/functional/issues_controller_test.rb
index 26b9dcb0b..6e09595d8 100644
--- a/test/functional/issues_controller_test.rb
+++ b/test/functional/issues_controller_test.rb
@@ -1405,6 +1405,7 @@ class IssuesControllerTest < ActionController::TestCase
:tag => 'input',
:attributes => {:type => 'file', :name => 'attachments[1][file]'}
}
+ assert_select 'input[name=?][maxlength=255]', 'attachments[1][description]'
end
def test_get_new_should_prefill_the_form_from_params