fix(import): project import does not move images symlinks into place

This commit is contained in:
grossmj 2026-07-13 18:19:52 +02:00
parent 7529ee4168
commit c528d2cd95
No known key found for this signature in database
GPG Key ID: 1E7DD6DBB53FF3D7

View File

@ -271,7 +271,7 @@ async def _upload_file(compute, project_id, file_path, path):
async def _import_images(controller, images_path):
"""
Copy images to the images directory or delete them if they already exists.
Copy images to the images directory or delete them if they already exist.
"""
image_dir = controller.images_path()
@ -279,11 +279,12 @@ async def _import_images(controller, images_path):
for (dirpath, dirnames, filenames) in os.walk(root, followlinks=False):
for filename in filenames:
path = os.path.join(dirpath, filename)
if os.path.islink(path):
continue
dst = os.path.join(image_dir, os.path.relpath(path, root))
os.makedirs(os.path.dirname(dst), exist_ok=True)
await wait_run_in_executor(shutil.move, path, dst)
if not os.path.exists(dst):
await wait_run_in_executor(shutil.move, path, dst)
if not os.path.islink(dst):
os.chmod(dst, stat.S_IWRITE | stat.S_IREAD | stat.S_IEXEC)
async def update_snapshots(snapshots_dir, project_path, project_name, project_id, reset_mac_addresses=True):