Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uploading avatar using BytesIO(bytes_object) fails without raising an exception #566

Open
3 tasks done
truenicoco opened this issue May 15, 2024 · 0 comments
Open
3 tasks done
Labels
bug Something isn't working

Comments

@truenicoco
Copy link

Summary

While it is possible to edit one's avatar using a file written on disk, it's not possible to pass a file-like buffer

Reproduction Steps

# bytes_ is a bytes object on len = 52718
await self.steam.user.edit(avatar=steam.Media(BytesIO(bytes_)))

Expected Results

Set my avatar on steam, or at least raise an exception if it fails.

Actual Results

It does not raise an exception, but this appears in the DEBUG logs:

DEBUG:steam.http:POST https://steamcommunity.com/actions/FileUploader with PAYLOAD: <aiohttp.formdata.FormData object at 0x7f2f275a5590> has returned 200
DEBUG:steam.http:POST https://steamcommunity.com/actions/FileUploader has received <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
<title>Image Uploader</title>
<style type="text/css">
...
<body>
The file you tried to upload was too large.  Please upload a file smaller than 1,024KB.
<a href="?type=player_avatar_image&sId=76561198048913696&bgColor=000000&fgColor=ffffff">Try Again</a>
</body>
</html>

Writing the same bytes to a file on disk and passing the path to this file instead of the BytesIO object works as intended

System Information

python version: 3.11.2
steam.py version: 1.0.1
aiohttp version: 3.9.5
betterproto version: 2.0.0b6
operating system info: Linux-6.6.13+bpo-amd64-x86_64-with-glibc2.36

Checklist

  • I have searched the issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my username, password, shared/identity secrets and refresh/access tokens from display, if visible.
@truenicoco truenicoco added the bug Something isn't working label May 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant