From fc0f2481e2e94da8c5de7801488d851b97045859 Mon Sep 17 00:00:00 2001 From: Eugene Dyudyunov Date: Tue, 23 Aug 2022 15:03:01 +0300 Subject: [PATCH] fix: get_bundles raises Request-URI Too Long error There could be a lot of bundles, so we can't use query params because it will raise the "Request-URI Too Long" error. Use the request data in such case. --- openedx/core/lib/blockstore_api/methods.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/openedx/core/lib/blockstore_api/methods.py b/openedx/core/lib/blockstore_api/methods.py index 7d7c65decdc1..bd2a6196a5e8 100644 --- a/openedx/core/lib/blockstore_api/methods.py +++ b/openedx/core/lib/blockstore_api/methods.py @@ -195,15 +195,17 @@ def delete_collection(collection_uuid): @toggle_blockstore_api def get_bundles(uuids=None, text_search=None): """ - Get the details of all bundles + Get the details of all bundles. """ query_params = {} if uuids: - query_params['uuid'] = ','.join(map(str, uuids)) + # Potentially we could have a lot of libraries which will lead to 414 error (Request-URI Too Long) + # if sending uuids in the query_params. So we have to use the request data instead. + data = {'uuid': ','.join(map(str, uuids))} if text_search: query_params['text_search'] = text_search version_url = api_url('bundles') + '?' + urlencode(query_params) - response = api_request('get', version_url) + response = api_request('get', version_url, json=data) # build bundle from response, convert map object to list and return return [_bundle_from_response(item) for item in response]