1
0
mirror of https://github.com/GNS3/gns3-server synced 2024-12-30 18:50:58 +00:00

Do not return an error if an image has already been uploaded

This commit is contained in:
grossmj 2024-04-26 19:02:50 +07:00
parent 644e659729
commit 38df4bea2e
No known key found for this signature in database
GPG Key ID: 0A2D76AC45EA25CD

View File

@ -149,8 +149,10 @@ async def upload_image(
if os.path.commonprefix([base_images_directory, full_path]) != base_images_directory:
raise ControllerForbiddenError(f"Cannot write image, '{image_path}' is forbidden")
if await images_repo.get_image(image_path):
raise ControllerBadRequestError(f"Image '{image_path}' already exists")
image = await images_repo.get_image(image_path)
if image:
log.warning(f"Image '{image_path}' already exists")
return image
try:
allow_raw_image = Config.instance().settings.Server.allow_raw_images