Inconsistency between mri and jruby on file upload --------------------------------------------------
Key: JRUBY-3261 URL: http://jira.codehaus.org/browse/JRUBY-3261 Project: JRuby Issue Type: Bug Affects Versions: JRuby 1.1.5 Environment: Rails 2.2.2, file_column plugin, osx leopard Reporter: steven bristol Assignee: Thomas E Enebo Priority: Minor When switching to jruby file uploads broke due to the following: file.original_filename no longer returned the original name, but returned the name as stored on disk in the tmp dir. I created a work around by using file.original_path, which i think is also broken because it is returning the name, not the path. Here is the diff which shows my work around: iff --git a/vendor/plugins/file_column/lib/file_column.rb b/vendor/plugins/file_column/lib index 27e1984..3ad01e9 100644 --- a/vendor/plugins/file_column/lib/file_column.rb +++ b/vendor/plugins/file_column/lib/file_column.rb @@ -214,8 +214,16 @@ module FileColumn # :nodoc: @tmp_dir = FileColumn.generate_temp_name @dir = File.join(tmp_base_dir, @tmp_dir) FileUtils.mkdir(@dir) - - @filename = FileColumn::sanitize_filename(file.original_filename) + ActiveRecord::Base.logger.debug file.original_filename.to_s.red_on_yellow + if PLATFORM == 'java' + @filename = FileColumn::sanitize_filename(file.original_path) + else + @filename = FileColumn::sanitize_filename(file.original_filename) + end local_file_path = File.join(tmp_base_dir,@tmp_dir,@filename) # stored uploaded file into local_file_path -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://jira.codehaus.org/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe from this list, please visit: http://xircles.codehaus.org/manage_email