use pathlib in more places, thereby fixing some bugs

This commit is contained in:
Laura Klünder 2023-11-11 12:06:46 +01:00
parent f5c33724dc
commit 2ad9f4a099
14 changed files with 24 additions and 36 deletions

View file

@ -1,5 +1,4 @@
import mimetypes
import os
import typing
from contextlib import suppress
@ -739,7 +738,7 @@ def sourceimage(request, filename):
return PermissionDenied
try:
return HttpResponse(open(os.path.join(settings.SOURCES_ROOT, filename), 'rb'),
return HttpResponse(open(settings.SOURCES_ROOT / filename, 'rb'),
content_type=mimetypes.guess_type(filename)[0])
except FileNotFoundError:
raise Http404