Skip to content

Issues with related images in tasks from local file share #9978

@zhiltsov-max

Description

@zhiltsov-max

Actions before raising this issue

  • I searched the existing issues and did not find anything similar.
  • I read/searched the docs

Steps to Reproduce

Can't display related images in a task from share:

  1. Create a task with related images from a locally attached file share (you can use these files - with_related_images.zip, unpack the archive)
  2. Try to open a job for annotation - the related images will fail to be displayed

Related images are not included in the task backup:

test_task_from_share_with_ri_backup.zip

Task creation from the backup fails (being fixed in #9972 and 485860a).
And if the fix is applied, the task can be imported, but the related images will be missing in the task.

Expected Behavior

The task can be opened with the related images displayed in the UI.
The related images are present in the backup.
The backup can be imported and the related images are visible in the new task.

Possible Solution

  • Fix image path validation to support share paths in
    data_upload_dir = db_data.get_upload_dirname()
    def _validate_ri_path(path: str) -> str:
    if os.path.isabs(path):
    if not path.startswith(data_upload_dir + os.sep):
    raise Exception("Invalid related image path")
    path = os.path.relpath(path, data_upload_dir)
    else:
    if not os.path.normpath(os.path.join(data_upload_dir, path)).startswith(
    data_upload_dir + os.sep
    ):
    raise Exception("Invalid related image path")
    return path
  • Copy related images into the backup (possible implementation in 485860a).

Context

No response

Environment

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions