diff --git a/cvat/apps/dataset_manager/views.py b/cvat/apps/dataset_manager/views.py index 3d77809b1c56..c6e5b554a4d6 100644 --- a/cvat/apps/dataset_manager/views.py +++ b/cvat/apps/dataset_manager/views.py @@ -30,7 +30,11 @@ def log_exception(logger=None, exc_info=True): def get_export_cache_dir(db_task): - return osp.join(db_task.get_task_dirname(), 'export_cache') + task_dir = osp.abspath(db_task.get_task_dirname()) + if osp.isdir(task_dir): + return osp.join(task_dir, 'export_cache') + else: + raise Exception('Task dir {} does not exist'.format(task_dir)) DEFAULT_CACHE_TTL = timedelta(hours=10) CACHE_TTL = DEFAULT_CACHE_TTL diff --git a/cvat/apps/engine/tests/_test_rest_api.py b/cvat/apps/engine/tests/_test_rest_api.py index 1c9da073ad63..46c6f3e56662 100644 --- a/cvat/apps/engine/tests/_test_rest_api.py +++ b/cvat/apps/engine/tests/_test_rest_api.py @@ -1458,8 +1458,9 @@ def test_api_v1_tasks_no_auth(self): def generate_image_file(filename): f = BytesIO() - width = random.randint(100, 800) - height = random.randint(100, 800) + gen = random.SystemRandom() + width = gen.randint(100, 800) + height = gen.randint(100, 800) image = Image.new('RGB', size=(width, height)) image.save(f, 'jpeg') f.name = filename