From 7348be2a022bfea965000d147e2804e053fb5757 Mon Sep 17 00:00:00 2001 From: Pallab Pain Date: Fri, 26 Jul 2024 14:34:56 +0530 Subject: [PATCH] fix(device): filter uploaded files by name in name_to_request_id The name_to_request_id decorator in device utils tries to find the request id corresponding an uploaded file. It invoke a list call to fetch the files and find out the id. However, list_uploaded_files_for_device SDK method supports filtering by file name. This commit fixes the call to filter with file name to only return the required data. Wrike Ticket: https://www.wrike.com/open.htm?id=1463047318 --- riocli/device/util.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/riocli/device/util.py b/riocli/device/util.py index 98641755..4501d977 100644 --- a/riocli/device/util.py +++ b/riocli/device/util.py @@ -95,11 +95,11 @@ def decorated(**kwargs): click.secho(str(e), fg=Colors.RED) raise SystemExit(1) + file_name = kwargs.pop('file_name') + device_guid = kwargs.get('device_guid') device = client.get_device(device_id=device_guid) - requests = device.list_uploaded_files_for_device() - - file_name = kwargs.pop('file_name') + requests = device.list_uploaded_files_for_device(filter_by_filename=file_name) file_name, request_id = find_request_id(requests, file_name)