1Password / connect-sdk-python

Python SDK for 1Password Connect
https://developer.1password.com/docs/connect
MIT License
200 stars 31 forks source link

`download_file` function uses the wrong file UUID in the API route #46

Closed hculea closed 1 year ago

hculea commented 2 years ago

Starting with Connect 1.5.4, the file_id in the item representation is no longer the file ID, but the wrapping field's ID. (see the difference between the content_path's last token and the ID, in any item response that contains files).

The download_file function of the Python Client builds the API route itself, using this file ID and disregarding the content_path attribute. This makes the route broken, and a 404 is consistently returned, when calling this endpoint.

The fix should be rather simple: use the content_path, possibly similar to how the Go SDK does it (see https://github.com/1Password/connect-sdk-go/blob/main/connect/client.go#L552)