Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

fix: Local files document root for local file upload bug in utils.py #278

Closed
wants to merge 1 commit into from
Closed
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: 5 additions & 1 deletion label_studio_converter/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,11 @@ def download(
if is_local_file:
filename, dir_path = url.split('/data/', 1)[-1].split('?d=')
dir_path = str(urllib.parse.unquote(dir_path))
filepath = os.path.join(LOCAL_FILES_DOCUMENT_ROOT, dir_path)
try:
from django.conf import settings.LOCAL_FILES_DOCUMENT_ROOT
filepath = os.path.join(settings.LOCAL_FILES_DOCUMENT_ROOT, dir_path)
except:
filepath = os.path.join(LOCAL_FILES_DOCUMENT_ROOT, dir_path)
if not os.path.exists(filepath):
raise FileNotFoundError(filepath)
if download_resources:
Expand Down
Loading