Project

General

Profile

Defect #26599 » 0002-Add-a-test-for-file-name-corruption-when-export-a-wi.patch

Go MAEDA, 2017-08-01 14:03

View differences:

test/functional/wiki_controller_test.rb
1087 1087
    assert_include 'h1. CookBook documentation v2', @response.body
1088 1088
  end
1089 1089

  
1090
  def test_show_filename_should_be_uri_encoded_for_ms_browsers
1091
    @request.session[:user_id] = 2
1092
    title = 'Этика_менеджмента'
1093

  
1094
    # Non-MS browsers
1095
    get :show, :params => {:project_id => 1, :id => title, :format => 'txt'}
1096
    assert_response :success
1097
    assert_equal "attachment; filename=\"#{title + '.txt'}\"",
1098
                  @response.headers['Content-Disposition']
1099

  
1100
    # Microsoft's browsers: filename should be URI encoded
1101
    @request.user_agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/52.0.2743.116 Safari/537.36 Edge/15.15063'
1102
    get :show, :params => {:project_id => 1, :id => title, :format => 'txt'}
1103
    assert_response :success
1104
    assert_equal "attachment; filename=\"#{URI.encode(title + '.txt')}\"",
1105
                  @response.headers['Content-Disposition']
1106
  end
1107

  
1090 1108
  def test_edit_unprotected_page
1091 1109
    # Non members can edit unprotected wiki pages
1092 1110
    @request.session[:user_id] = 4
(3-3/3)