Project

General

Profile

Actions

Defect #602

closed

File module will upload file even when no Version is specified, and appear successful.

Added by Kit Plummer almost 17 years ago. Updated almost 16 years ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Category:
Attachments
Target version:
-
Start date:
2008-02-04
Due date:
% Done:

0%

Estimated time:
Resolution:
Affected version:

Description

Need to not allow the file upload if no version is specified in the File module.


Files

file_upload_fix.diff (1.29 KB) file_upload_fix.diff Kit Plummer, 2008-02-04 18:27

Related issues

Related to Redmine - Defect #1053: Unable to upload file via file menu due to version filed.Closed2008-04-13

Actions
Actions #1

Updated by Kit Plummer almost 17 years ago

Here's a patch (only includes the en.yml update):

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." 
Actions #2

Updated by Kit Plummer almost 17 years ago

Attached diff too.

Actions #3

Updated by Mischa The Evil about 16 years ago

This (still) works works for current trunk (0.8.0-RC1) and looks like the desired fix for issue #1053 if the design isn't going to be modified...

Actions #4

Updated by Mischa The Evil almost 16 years ago

  • Category set to Attachments
  • Status changed from New to Closed

This is fixed/implemented in 0.8.1, thus issue closed...

Actions

Also available in: Atom PDF