cobrateam / cobrateam/django-htmlmin

IndexError: list index out of range

Open
#28 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
542
Forks
72
PR merge metrics
No merged PRs in 30d

Description

hi guys,
thanks for sharing this app, i really like it. just one strange thing, one some pages i'll get a django error message, even if i am still able to open the page:

File "/home/user/webapps/wiki/lib/python2.6/django/core/handlers/base.py", line 178, in get_response
response = middleware_method(request, response)

File "/home/user/lib/python2.6/htmlmin/middleware.py", line 25, in process_response
response.content = html_minify(response.content, ignore_comments=not keep_comments)

File "/home/user/lib/python2.6/htmlmin/minify.py", line 36, in html_minify
if not between_two_tags(minified_line, minified_lines, index):

File "/home/user/lib/python2.6/htmlmin/util.py", line 11, in between_two_tags
if current_line and not current_line.startswith('<') and not all_lines[index-1].endswith('>'):

IndexError: list index out of range

any idea? or is it my html? i double checked everything.
thanks,
horndash

ps. there are two typos in the documentation:

it says: from htmlmin.decorator import no_minified_response
but it should say from htmlmin.decoratorS import noT_minified_response

Contributor guide

No contributing guide indexed for this repository

Research direction

Start with the traceback locations in htmlmin/middleware.py, htmlmin/minify.py, and htmlmin/util.py, then reproduce the error using the affected page HTML. Confirm the response can be minified without an IndexError, and separately check the documentation examples for the two reported import typos.

Written by the indexing model from the issue text.

Assessment

Tech stack
django, python
Domain
backend, documentation
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.