Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions htmlark.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import mimetypes
import sys
from typing import Callable
from urllib.parse import quote
from urllib.parse import quote, unquote
from urllib.parse import urljoin
from urllib.parse import urlparse

Expand Down Expand Up @@ -66,7 +66,9 @@ def _get_resource(resource_url: str) -> (str, bytes):
raise NameError("HTTP URL found but requests not available")
elif url_parsed.scheme == '':
# '' is local file
with open(resource_url, 'rb') as f:
# unescape characters since the local filesystem won't translate them
local_path = unquote(resource_url)
with open(local_path, 'rb') as f:
data = f.read()
mimetype, _ = mimetypes.guess_type(resource_url)
elif url_parsed.scheme == 'data':
Expand Down