Skip to content

Commit

Permalink
Do not return an error if an image has already been uploaded
Browse files Browse the repository at this point in the history
  • Loading branch information
grossmj committed Apr 26, 2024
1 parent 644e659 commit 38df4be
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions gns3server/api/routes/controller/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 38df4be

Please sign in to comment.