Skip to content

Commit

Permalink
fix: drop response.charset because charset deprecated (#206)
Browse files Browse the repository at this point in the history
I took a quick peek at upstream to see if this has any backwards-breaking issues whereby we'd need to check the `werkzeug` version, but from my reading it looks it should be fine most of the time.

Also, this was deprecated back in April's `2.3.0` release and then removed in the recent `3.0.0` release, so I suspect most of our userbase will have already migrated to those versions.

Given this lib is a dev-tooling library not typically used in production, I'm not too worried about ensuring we support the 0.01% case where someone is using an old version of `werkzeug` + a custom charset.

More context:
* pallets/werkzeug#2602
* pallets/werkzeug#2641
* pallets/werkzeug#2768
  • Loading branch information
miettal committed Oct 13, 2023
1 parent 3b25e11 commit 9571d06
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/flask_debugtoolbar/__init__.py
Expand Up @@ -231,9 +231,9 @@ def process_response(self, response):
return response

if 'gzip' in response.headers.get('Content-Encoding', ''):
response_html = gzip_decompress(response.data).decode(response.charset)
response_html = gzip_decompress(response.data).decode()
else:
response_html = response.data.decode(response.charset)
response_html = response.get_data(as_text=True)

no_case = response_html.lower()
body_end = no_case.rfind('</body>')
Expand Down

1 comment on commit 9571d06

@luis-ferrarezi
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, but I keep with the problem at the line 260 [content = content.encode(response.charset)]

Please sign in to comment.