qld-gov-au / ckanext-csrf-filter

A CKAN extension to add protection against Cross-Site Request Forgery attacks
GNU Affero General Public License v3.0
0 stars 6 forks source link

[QOL-8392] ensure response body is of a type we can process #18

Closed ThrawnCA closed 2 years ago

ThrawnCA commented 2 years ago

Without this, CKAN 2.9 can give an error:

    [Tue Nov 16 15:24:53.236950 2021] [:error] [pid 25176]   File "/mnt/local_data/ckan_venv/src/ckanext-csrf-filter/ckanext/csrf_filter/anti_csrf
    .py", line 360, in insert_token
    [Tue Nov 16 15:24:53.236953 2021] [:error] [pid 25176]     html = POST_FORM.sub(insert_form_token, six.text_type(html))
    [Tue Nov 16 15:24:53.236955 2021] [:error] [pid 25176] UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6152: ordinal not 
    in range(128)