From: <pet...@us...> - 2007-05-27 13:41:29
|
Revision: 12370 http://svn.sourceforge.net/jikesrvm/?rev=12370&view=rev Author: peter_donald Date: 2007-05-27 06:41:28 -0700 (Sun, 27 May 2007) Log Message: ----------- Make sure the web interface allows uploads that are gzipped. Modified Paths: -------------- cattrack/trunk/app/controllers/test_run_controller.rb Modified: cattrack/trunk/app/controllers/test_run_controller.rb =================================================================== --- cattrack/trunk/app/controllers/test_run_controller.rb 2007-05-27 12:36:52 UTC (rev 12369) +++ cattrack/trunk/app/controllers/test_run_controller.rb 2007-05-27 13:41:28 UTC (rev 12370) @@ -24,13 +24,16 @@ if @record.valid? tmp_dir = "#{SystemSetting['tmp.dir']}/uploads" FileUtils.mkdir_p(tmp_dir) unless (File.exist?(tmp_dir) and File.directory?(tmp_dir)) - file = Tempfile.new('upload', tmp_dir) + base_file = @record.data.original_filename.gsub(/^.*(\\|\/)/, '').gsub(/[^\w._-]/,'') + filename = "#{tmp_dir}/#{Time.now.usec}_#{session.id}_#{base_file}" + file = File.open(filename, File::CREAT|File::TRUNC|File::RDWR) file.write(@record.data.read) file.close begin - @test_run = TestRunBuilder.create_from(@record.host, file.path, current_user, Time.now) + @test_run = TestRunBuilder.create_from(@record.host, filename, current_user, Time.now) + TestRunTransformer.build_olap_model_from(@test_run) if @test_run ensure - file.unlink + File.delete(filename) end if @test_run flash[:notice] = "#{@test_run.label} was successfully created." This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |