Defect #40301
closed
Error when create a version with custom field of "File" type from Issue page
Added by Morris Penasso 10 months ago.
Updated 12 days ago.
Description
Following this path:
Open existing issue -> Edit -> Target Version -> Create new one with green button.
I have a "File" custom field that is not required but when i try to save version after enter the name, the system say me that the custom field is not valid.
I try to delete it and create another one but i obtain the same error ( only with "File" custom field ).
System informations:
Environment:
Redmine version 5.1.0.stable
Ruby version 3.0.2-p107 (2021-07-07) [x86_64-linux-gnu]
Rails version 6.1.7.6
Environment production
SCM:
Mercurial 6.1.1
Git 2.34.1
Filesystem
Redmine plugins:
redmine_dmsf 3.1.3
Files
I have confirmed the issue.
Reviewing the HTML for the new version modal, I found enctype="multipart/form-data" was missing.
Adding :html => {:multipart => true} to versions/_new_modal.html.erb adds this attribute and enables successful version registration.
diff --git a/app/views/versions/_new_modal.html.erb b/app/views/versions/_new_modal.html.erb
index 052a739747..02c57abc4c 100644
--- a/app/views/versions/_new_modal.html.erb
+++ b/app/views/versions/_new_modal.html.erb
@@ -1,6 +1,6 @@
<h3 class="title"><%=l(:label_version_new)%></h3>
-<%= labelled_form_for @version, :url => project_versions_path(@project), :remote => true do |f| %>
+<%= labelled_form_for @version, :url => project_versions_path(@project), :html => {:multipart => true}, :remote => true do |f| %>
<%= render :partial => 'versions/form', :locals => { :f => f } %>
<p class="buttons">
<%= submit_tag l(:button_create), :name => nil %>
- Target version set to 5.1.5
- Subject changed from Issue - New version: Error when create a version with custom field of "File" type to Error when create a version with custom field of "File" type from Issue page
- Status changed from Confirmed to Resolved
- Assignee set to Marius BĂLTEANU
- Resolution set to Fixed
I've committed the patch posted by Takenori TAKAKI together with a system test.
Thanks for reporting and fixing the issue.
- Status changed from Resolved to Closed
Also available in: Atom
PDF