diff --git a/requirements-swh.txt b/requirements-swh.txt --- a/requirements-swh.txt +++ b/requirements-swh.txt @@ -1,4 +1,4 @@ -swh.core >= 0.0.54 +swh.core >= 0.0.56 swh.model >= 0.0.27 swh.objstorage >= 0.0.17 swh.scheduler >= 0.0.14 diff --git a/swh/storage/api/client.py b/swh/storage/api/client.py --- a/swh/storage/api/client.py +++ b/swh/storage/api/client.py @@ -12,9 +12,7 @@ class RemoteStorage(SWHRemoteAPI): """Proxy to a remote storage API""" - def __init__(self, url, timeout=None): - super().__init__( - api_exception=StorageAPIError, url=url, timeout=timeout) + api_exception = StorageAPIError def check_config(self, *, check_write): return self.post('check_config', {'check_write': check_write}) @@ -54,8 +52,8 @@ return self.post('directory/missing', {'directories': directories}) def directory_ls(self, directory, recursive=False): - return self.get('directory/ls', {'directory': directory, - 'recursive': recursive}) + return self.post('directory/ls', {'directory': directory, + 'recursive': recursive}) def revision_get(self, revisions): return self.post('revision', {'revisions': revisions}) diff --git a/swh/storage/api/server.py b/swh/storage/api/server.py --- a/swh/storage/api/server.py +++ b/swh/storage/api/server.py @@ -4,7 +4,6 @@ # See top-level LICENSE file for more information import os -import json import logging from flask import request @@ -112,11 +111,10 @@ **decode_request(request))) -@app.route('/directory/ls', methods=['GET']) +@app.route('/directory/ls', methods=['POST']) def directory_ls(): - dir = request.args['directory'].encode('utf-8', 'surrogateescape') - rec = json.loads(request.args.get('recursive', 'False').lower()) - return encode_data(get_storage().directory_ls(dir, recursive=rec)) + return encode_data(get_storage().directory_ls( + **decode_request(request))) @app.route('/revision/add', methods=['POST'])