From 4ccda0a72fda9b0bbde8f086d91d131811ae3f47 Mon Sep 17 00:00:00 2001 From: Robert Andrei Moldoveanu Date: Thu, 10 Apr 2025 16:23:09 +0300 Subject: [PATCH 1/2] fix(pack): validate project params --- src/uipath/_cli/cli_pack.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/uipath/_cli/cli_pack.py b/src/uipath/_cli/cli_pack.py index f45b7c45..d28073c4 100644 --- a/src/uipath/_cli/cli_pack.py +++ b/src/uipath/_cli/cli_pack.py @@ -292,6 +292,21 @@ def pack_fn(projectName, description, entryPoints, version, authors, directory): def read_toml_project(file_path: str) -> dict[str, any]: with open(file_path, "rb") as f: content = tomllib.load(f) + if "project" not in content: + raise Exception("pyproject.toml is missing the required field: project") + if "name" not in content["project"]: + raise Exception( + "pyproject.toml is missing the required field: project.name" + ) + if "description" not in content["project"]: + raise Exception( + "pyproject.toml is missing the required field: project.description" + ) + if "version" not in content["project"]: + raise Exception( + "pyproject.toml is missing the required field: project.version" + ) + return { "name": content["project"]["name"], "description": content["project"]["description"], @@ -320,6 +335,20 @@ def pack(root): ) return config = check_config(root) + if not config["project_name"] or config["project_name"].strip() == "": + raise Exception("Project name cannot be empty") + + if not config["description"] or config["description"].strip() == "": + raise Exception("Project description cannot be empty") + + invalid_chars = ["&", "<", ">", '"', "'", ";"] + for char in invalid_chars: + if char in config["project_name"]: + raise Exception(f"Project name contains invalid character: '{char}'") + + for char in invalid_chars: + if char in config["description"]: + raise Exception(f"Project description contains invalid character: '{char}'") click.echo( f"Packaging project {config['project_name']}:{version or config['version']} description {config['description']} authored by {config['authors']}" ) From 198bea0a690a4b11db97bcc12a5c2a3d74aa28db Mon Sep 17 00:00:00 2001 From: Robert Andrei Moldoveanu Date: Mon, 14 Apr 2025 12:30:39 +0300 Subject: [PATCH 2/2] fix: env default url --- src/uipath/_cli/cli_init.py | 2 +- tests/cli/test_init.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uipath/_cli/cli_init.py b/src/uipath/_cli/cli_init.py index ca4e9e8f..5adc9ca6 100644 --- a/src/uipath/_cli/cli_init.py +++ b/src/uipath/_cli/cli_init.py @@ -20,7 +20,7 @@ def generate_env_file(target_directory): click.echo(f"Created {relative_path} file.") with open(env_path, "w") as f: f.write("UIPATH_ACCESS_TOKEN=YOUR_TOKEN_HERE\n") - f.write("UIPATH_URL=https://alpha.uipath.com/ACCOUNT_NAME/TENANT_NAME\n") + f.write("UIPATH_URL=https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME\n") def get_user_script(directory: str, entrypoint: Optional[str] = None) -> Optional[str]: diff --git a/tests/cli/test_init.py b/tests/cli/test_init.py index 6a2caa8d..ef640273 100644 --- a/tests/cli/test_init.py +++ b/tests/cli/test_init.py @@ -23,7 +23,7 @@ def test_init_env_file_creation(runner: CliRunner, temp_dir: str) -> None: content = f.read() assert "UIPATH_ACCESS_TOKEN=YOUR_TOKEN_HERE" in content assert ( - "UIPATH_URL=https://alpha.uipath.com/ACCOUNT_NAME/TENANT_NAME" + "UIPATH_URL=https://cloud.uipath.com/ACCOUNT_NAME/TENANT_NAME" in content )