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

atproto.repoUploadBlob: allow parsing or specifying Content Type #850

Open
sodle opened this issue Nov 26, 2024 · 1 comment
Open

atproto.repoUploadBlob: allow parsing or specifying Content Type #850

sodle opened this issue Nov 26, 2024 · 1 comment

Comments

@sodle
Copy link

sodle commented Nov 26, 2024

When calling repoUploadBlob, the function always specifies the MIME Type as */*. This causes problems when trying to use the uploaded blob later, for example when specifying it as the avatar for a list:

XRPC ERROR 400: InvalidMimeType: Wrong type of file. It is */* but it must match image/png,image/jpeg.
@sodle
Copy link
Author

sodle commented Nov 26, 2024

Problematic code seems to be at repouploadBlob.go#L23.

Seems like it would be an easy fix to add a content-type parameter to this function -- however, the // Code generated by [...] DO NOT EDIT comment at the top of that file makes me hesitant to do that.

Additionally, a sensible default would be nice. How about:

  • if a content-type arg is provided, use that
  • if that arg is empty, attempt to detect the mime-type using something like vincent-petithory/dataurl
  • if that also fails, default to */* as a last resort

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

No branches or pull requests

1 participant