Skip to content

Commit

Permalink
fix: corrects regex for fetching resources
Browse files Browse the repository at this point in the history
The regex defined in commands for fetching resources in bulk to perform
batch operations has a flaw where it did not match the given pattern at
its boundaries. This can lead to unintended consequences while
performing such batch operations. This commit fixes that.

Wrike Ticket: https://www.wrike.com/open.htm?id=1299310557
  • Loading branch information
pallabpain committed Feb 12, 2024
1 parent 62a2828 commit 1d3c75e
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion riocli/deployment/util.py
Original file line number Diff line number Diff line change
@@ -174,7 +174,7 @@ def fetch_deployments(
if (include_all or deployment_name_or_regex == deployment.name or
deployment_name_or_regex == deployment.deploymentId or
(deployment_name_or_regex not in deployment.name and
re.search(deployment_name_or_regex, deployment.name))):
re.search(r'^{}$'.format(deployment_name_or_regex), deployment.name))):
result.append(deployment)

return result
2 changes: 1 addition & 1 deletion riocli/device/util.py
Original file line number Diff line number Diff line change
@@ -115,7 +115,7 @@ def fetch_devices(
if (include_all or device.name == device_name_or_regex or
device_name_or_regex == device.uuid or
(device_name_or_regex not in device.name and
re.search(device_name_or_regex, device.name))):
re.search(r'^{}$'.format(device_name_or_regex), device.name))):
result.append(device)

return result
2 changes: 1 addition & 1 deletion riocli/package/util.py
Original file line number Diff line number Diff line change
@@ -94,7 +94,7 @@ def fetch_packages(
if (include_all or package_name_or_regex == pkg.packageName or
pkg.packageId == package_name_or_regex or
(package_name_or_regex not in pkg.packageName and
re.search(package_name_or_regex, pkg.packageName))):
re.search(r'^{}$'.format(package_name_or_regex), pkg.packageName))):
result.append(pkg)

return result

0 comments on commit 1d3c75e

Please sign in to comment.