mirror of
https://github.com/GNS3/gns3-server
synced 2024-11-25 01:38:08 +00:00
Allow raw images by default. Fixes https://github.com/GNS3/gns3-server/issues/2097
This commit is contained in:
parent
8ad7b3f613
commit
9a7b3bed25
@ -54,6 +54,9 @@ configs_path = /home/gns3/GNS3/configs
|
|||||||
; "Affinity-square-gray", "Affinity-circle-blue", "Affinity-circle-red" and "Affinity-circle-gray"
|
; "Affinity-square-gray", "Affinity-circle-blue", "Affinity-circle-red" and "Affinity-circle-gray"
|
||||||
default_symbol_theme = Affinity-square-blue
|
default_symbol_theme = Affinity-square-blue
|
||||||
|
|
||||||
|
; Option to enable or disable raw images to be uploaded to the server
|
||||||
|
allow_raw_images = True
|
||||||
|
|
||||||
; Option to automatically send crash reports to the GNS3 team
|
; Option to automatically send crash reports to the GNS3 team
|
||||||
report_errors = True
|
report_errors = True
|
||||||
|
|
||||||
|
@ -70,7 +70,6 @@ async def upload_image(
|
|||||||
current_user: schemas.User = Depends(get_current_active_user),
|
current_user: schemas.User = Depends(get_current_active_user),
|
||||||
rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)),
|
rbac_repo: RbacRepository = Depends(get_repository(RbacRepository)),
|
||||||
install_appliances: Optional[bool] = False,
|
install_appliances: Optional[bool] = False,
|
||||||
allow_raw_image: Optional[bool] = False
|
|
||||||
) -> schemas.Image:
|
) -> schemas.Image:
|
||||||
"""
|
"""
|
||||||
Upload an image.
|
Upload an image.
|
||||||
@ -91,6 +90,7 @@ async def upload_image(
|
|||||||
raise ControllerBadRequestError(f"Image '{image_path}' already exists")
|
raise ControllerBadRequestError(f"Image '{image_path}' already exists")
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
allow_raw_image = Config.instance().settings.Server.allow_raw_images
|
||||||
image = await write_image(image_path, full_path, request.stream(), images_repo, allow_raw_image=allow_raw_image)
|
image = await write_image(image_path, full_path, request.stream(), images_repo, allow_raw_image=allow_raw_image)
|
||||||
except (OSError, InvalidImageError, ClientDisconnect) as e:
|
except (OSError, InvalidImageError, ClientDisconnect) as e:
|
||||||
raise ControllerError(f"Could not save image '{image_path}': {e}")
|
raise ControllerError(f"Could not save image '{image_path}': {e}")
|
||||||
|
@ -136,6 +136,7 @@ class ServerSettings(BaseModel):
|
|||||||
symbols_path: str = "~/GNS3/symbols"
|
symbols_path: str = "~/GNS3/symbols"
|
||||||
configs_path: str = "~/GNS3/configs"
|
configs_path: str = "~/GNS3/configs"
|
||||||
default_symbol_theme: BuiltinSymbolTheme = BuiltinSymbolTheme.affinity_square_blue
|
default_symbol_theme: BuiltinSymbolTheme = BuiltinSymbolTheme.affinity_square_blue
|
||||||
|
allow_raw_images: bool = True
|
||||||
report_errors: bool = True
|
report_errors: bool = True
|
||||||
additional_images_paths: List[str] = Field(default_factory=list)
|
additional_images_paths: List[str] = Field(default_factory=list)
|
||||||
console_start_port_range: int = Field(5000, gt=0, le=65535)
|
console_start_port_range: int = Field(5000, gt=0, le=65535)
|
||||||
|
Loading…
Reference in New Issue
Block a user