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

Implement blob size limit #7

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

maciek-szn
Copy link
Contributor

There is a blob size limit (one million bytes) (see also bluesky-social/atproto#1740). If you try to send a larger blob, an error message is returned:

Could not create post (400, BlobTooLarge: This file is too large. It is [...] but the maximum size is 976.56KB.)

This PR implements a check of the size of the file being sent and if it exceeds the limit, the blob is not sent and the embed does not have a thumbnail.

@innocenzi
Copy link
Owner

Rather than manually checking for the blob size, which might change in the future, I think we should instead catch the exception, and re-send the post without the embed then.

What do you think?

@maciek-szn
Copy link
Contributor Author

You're probably right, but I have no idea how to do this in a clean way.

@maciek-szn
Copy link
Contributor Author

Unfortunately, the problem cannot be detected when the blob is uploaded via cardyb.bsky.app (the upload is successful). The error appears only when you try to publish the post.

@innocenzi
Copy link
Owner

Alright, let's go with that implementation for now then. Could you add a test?

@maciek-szn
Copy link
Contributor Author

I've been trying to write the test for the past two days, but without success. As I said before, I'm not very experienced. I'm sorry.

@innocenzi
Copy link
Owner

It's okay! Thanks for trying. I'll write them when I have some time 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants