genouest / biomaj-download

Download microservice for BioMAJ
GNU Affero General Public License v3.0
1 stars 7 forks source link

cURL errors in list() are ignored #29

Closed duboism closed 4 years ago

duboism commented 4 years ago

Errors raised by cURL in CurlDownload.list() are not caught and the function returns an empty list. This may lead to hard to understand errors later in the workflow.

For instance, trying to access non-existing location:

>>> sftpd = CurlDownload(curl_protocol="sftp", host="test.rebex.net", rootdir="/toto")
>>> sftpd.set_credentials("demo:password")
>>> sftpd.list()
([], [])

Using curl for similar operation leads to an error:

$ curl -u demo:password sftp://test.rebex.net/toto
curl: (78) Could not open remote file for reading: SFTP server: Path not found.
$ echo $?
78

Similarly, using a wrong password is not detected:

>>> sftpd = CurlDownload(curl_protocol="sftp", host="test.rebex.net", rootdir="/")
>>> sftpd.set_credentials("demo:badpassword")
>>> sftpd.list()
([], [])

Using curl:

$ curl -u demo:badpassword sftp://test.rebex.net/
curl: (67) Authentication failure
$ echo $?
67
duboism commented 4 years ago

Based on examples in PR #30 this is closed now.