Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"

[project]
name = "socketsecurity"
version = "2.2.74"
version = "2.2.76"
requires-python = ">= 3.10"
license = {"file" = "LICENSE"}
dependencies = [
Expand All @@ -16,7 +16,7 @@ dependencies = [
'GitPython',
'packaging',
'python-dotenv',
"socketdev>=3.0.31,<4.0.0",
"socketdev>=3.0.32,<4.0.0",
"bs4>=0.0.2",
"markdown>=3.10",
]
Expand Down
2 changes: 1 addition & 1 deletion socketsecurity/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
__author__ = 'socket.dev'
__version__ = '2.2.74'
__version__ = '2.2.76'
USER_AGENT = f'SocketPythonCLI/{__version__}'
11 changes: 10 additions & 1 deletion socketsecurity/socketcli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,15 @@

load_dotenv()

def _normalize_workspace(workspace):
"""Return None for unset/blank workspace values so SDK omits query param."""
if workspace is None:
return None
if isinstance(workspace, str):
normalized = workspace.strip()
return normalized or None
return workspace

def cli():
try:
main_code()
Expand Down Expand Up @@ -465,7 +474,7 @@ def main_code():
set_as_pending_head=is_default_branch,
tmp=False,
scan_type='socket_tier1' if config.reach else 'socket',
workspace=config.workspace or None,
workspace=_normalize_workspace(config.workspace),
)

params.include_license_details = not config.exclude_license_details
Expand Down
18 changes: 18 additions & 0 deletions tests/unit/test_socketcli_workspace.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
from socketsecurity.socketcli import _normalize_workspace


def test_normalize_workspace_none():
assert _normalize_workspace(None) is None


def test_normalize_workspace_empty_string():
assert _normalize_workspace("") is None


def test_normalize_workspace_whitespace_string():
assert _normalize_workspace(" ") is None


def test_normalize_workspace_valid_string():
assert _normalize_workspace("my-workspace") == "my-workspace"

Loading