Skip to content

Commit

Permalink
fix: Import gz HAR file from export
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Feb 28, 2024
1 parent 0735129 commit e57268a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion website/web/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import base64
import calendar
import functools
import gzip
import hashlib
import http
import json
Expand Down Expand Up @@ -1090,7 +1091,11 @@ def submit_capture() -> str | Response | WerkzeugResponse:
with ZipFile(BytesIO(request.files['full_capture'].stream.read()), 'r') as lookyloo_capture:
potential_favicons = set()
for filename in lookyloo_capture.namelist():
if filename.endswith('0.har'):
if filename.endswith('0.har.gz'):
# new formal
har = json.loads(gzip.decompress(lookyloo_capture.read(filename)))
elif filename.endswith('0.har'):
# old format
har = json.loads(lookyloo_capture.read(filename))
elif filename.endswith('0.html'):
html = lookyloo_capture.read(filename).decode()
Expand Down

0 comments on commit e57268a

Please sign in to comment.