Skip to content

Commit c55c53a

Browse files
committed
correct location of .parrent for media and static
1 parent 020e1bd commit c55c53a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/backend/InvenTree/report/models.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,17 @@ def url_fetcher(url: str, timeout=10, ssl_context=None):
5454
5555
All other requests will fall back to `weasyprint.default_url_fetcher`.
5656
"""
57-
media = config.get_media_dir().resolve().parent
58-
static = config.get_static_dir().resolve().parent
57+
media = config.get_media_dir().resolve()
58+
static = config.get_static_dir().resolve()
5959
if url.startswith(WE_BASE_URL):
6060
# .path always starts with a '/' character, which must be trimmed off.
6161
u = unquote(urlparse(url).path)[1:]
6262
if u.startswith('/media'):
63-
pth = media.joinpath(u).resolve()
63+
pth = media.parent.joinpath(u).resolve()
6464
if media in pth.parents:
6565
return {'file_obj': open(pth, 'rb')}
6666
elif u.startswith('/static'):
67-
pth = static.joinpath(u).resolve()
67+
pth = static.parent.joinpath(u).resolve()
6868
if static in pth.parents:
6969
return {'file_obj': open(pth, 'rb')}
7070
return default_url_fetcher(url, timeout=timeout, ssl_context=ssl_context)

0 commit comments

Comments
 (0)