htmlmin icon indicating copy to clipboard operation
htmlmin copied to clipboard

Incorrect text/html header detection in the middleware

Open bfontaine opened this issue 2 years ago • 1 comments

Hello, The middleware looks for a header Content-Type whose value is exactly text/html. However Flask’s default is text/html; charset=utf-8. Using this middleware as-is in a Flask app thus doesn’t work.

bfontaine avatar Mar 26 '22 11:03 bfontaine

Well even if I fix this the middleware still fails:

    return [self.minifier.minify(*html)]
  File "...-py3.9/lib/python3.9/site-packages/htmlmin/main.py", line 162, in minify
    self.input(*input)
  File "...-py3.9/lib/python3.9/site-packages/htmlmin/main.py", line 174, in input
    self._parser.feed(i)
  File "...-py3.9/lib/python3.9/site-packages/htmlmin/python3html/parser.py", line 124, in feed
    self.rawdata = self.rawdata + data
TypeError: can only concatenate str (not "bytes") to str

bfontaine avatar Mar 26 '22 12:03 bfontaine