Open ra-jeev opened 12 months ago
@ra-jeev thanks for raising this issue! 🙏🏼 Looks like there are a few things wrong with how we handle images in the CLI:
@stnguyen90 Thanks a lot for acknowledging the issue. Glad I was able to notice this bug while playing around with the appwrite CLI (actually I was trying to connect Appwrite CLI to the 1Password CLI, and that is when I noticed it).
Hi, I can work on this if no one's working on this
@adarshjhaa100, are you still interested in working on this?
@stnguyen90 yes I am interested. Just confirming, need to raise PR to the SDK Generator repo right ?
@adarshjhaa100, assigned! Yes, the SDK Generator repo, please.
@stnguyen90 Looks like something's changed. The latest version gives a slightly different issue:
The 1st and 3rd point you've mentioned seems a correct analysis of the issue. I made the change and am able to download the image:
Would like to add something for the 2nd point here. This is a GET request, which has a null request body. So, it seems fair to omit the content-type
from request header while fetching avatar. (I presume content-type here is the type of request body, correct me if im wrong)
Given the above analysis, just need to figure out how to handle for images.
Couple of solutions which I can think of:
1) Probably can use the response header content-type
to identify and then apply appropriate transformResponse
. But I don't see a way to pull responseHeader in the request config.
2) I see that responseType
of 'arraybuffer'
is used for avatars only. So, could use that to change the transformResponse
.
Do let me know if either of these seem feasible. I'll raise a PR post that.
👟 Reproduction steps
appwrite avatars --verbose getFlag --code af --destination test.png
👍 Expected behavior
Should download the flag icon and create a new file at the destination path.
👎 Actual Behavior
Throws the below error:
Error Not Found
🎲 Appwrite version
Appwrite CLI v2.0.2
💻 Operating system
macOS v12.6.7
🧱 Your Environment
Using the appwrite CLI v2.0.2 on macbook pro with zsh.
👀 Have you spent some time to check if this issue has been raised before?
🏢 Have you read the Code of Conduct?