Skip to content

Commit

Permalink
fix: get_bundles raises Request-URI Too Long error
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
dyudyunov committed Aug 23, 2022
1 parent bd00331 commit fc0f248
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions openedx/core/lib/blockstore_api/methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down

0 comments on commit fc0f248

Please sign in to comment.