https://www.redmine.org/https://www.redmine.org/favicon.ico?16793021292008-02-04T17:21:30ZRedmineRedmine - Defect #602: File module will upload file even when no Version is specified, and appear successful.https://www.redmine.org/issues/602?journal_id=11582008-02-04T17:21:30ZKit Plummer
<ul></ul><p>Here's a patch (only includes the en.yml update):</p>
<pre>
Index: app/controllers/projects_controller.rb
===================================================================
--- app/controllers/projects_controller.rb (revision 1118)
+++ app/controllers/projects_controller.rb (working copy)
@@ -262,9 +262,13 @@
def add_file
if request.post?
@version = @project.versions.find_by_id(params[:version_id])
+ if @version == nil
+ flash[:error] = l(:error_need_version_to_upload_file)
+ else
attachments = attach_files(@version, params[:attachments])
Mailer.deliver_attachments_added(attachments) if !attachments.empty? && Setting.notified_events.include?('file_added')
redirect_to :controller => 'projects', :action => 'list_files', :id => @project
+ end
end
@versions = @project.versions.sort
end
Index: lang/en.yml
===================================================================
--- lang/en.yml (revision 1118)
+++ lang/en.yml (working copy)
@@ -80,6 +80,7 @@
error_can_t_load_default_data: "Default configuration could not be loaded: %s"
error_scm_not_found: "Entry and/or revision doesn't exist in the repository."
error_scm_command_failed: "An error occurred when trying to access the repository: %s"
+error_need_version_to_upload_file: "Version is required. Create a Version if one doesn't exist."
</pre> Redmine - Defect #602: File module will upload file even when no Version is specified, and appear successful.https://www.redmine.org/issues/602?journal_id=11592008-02-04T17:27:18ZKit Plummer
<ul><li><strong>File</strong> <a href="/attachments/165">file_upload_fix.diff</a> <a class="icon-only icon-download" title="Download" href="/attachments/download/165/file_upload_fix.diff">file_upload_fix.diff</a> added</li></ul><p>Attached diff too.</p> Redmine - Defect #602: File module will upload file even when no Version is specified, and appear successful.https://www.redmine.org/issues/602?journal_id=59912008-12-08T08:49:39ZMischa The Evil
<ul></ul><p>This (still) works works for current trunk (<code>0.8.0-RC1</code>) and looks like the desired fix for issue <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Defect: Unable to upload file via file menu due to version filed. (Closed)" href="https://www.redmine.org/issues/1053">#1053</a> if the design isn't going to be modified...</p> Redmine - Defect #602: File module will upload file even when no Version is specified, and appear successful.https://www.redmine.org/issues/602?journal_id=64002008-12-31T12:04:13ZMischa The Evil
<ul><li><strong>Category</strong> set to <i>Attachments</i></li><li><strong>Status</strong> changed from <i>New</i> to <i>Closed</i></li></ul><p>This is fixed/implemented in <code>0.8.1</code>, thus issue closed...</p>