tangled
alpha
login
or
join now
moth11.net
/
rvcx
3
fork
atom
backend for xcvr appview
3
fork
atom
overview
issues
4
pulls
pipelines
boop
moth11.net
5 months ago
20a0406f
a72c1a20
+9
-1
1 changed file
expand all
collapse all
unified
split
server
internal
oauth
oauthclient.go
+9
-1
server/internal/oauth/oauthclient.go
···
1
1
package oauth
2
2
3
3
import (
4
4
+
"bytes"
4
5
"context"
5
6
"encoding/json"
6
7
"errors"
7
8
"fmt"
9
9
+
"io"
8
10
9
11
"github.com/bluesky-social/indigo/api/atproto"
10
12
"github.com/bluesky-social/indigo/atproto/auth/oauth"
···
178
180
func UploadBLOB(cs *oauth.ClientSession, file multipart.File, ctx context.Context) (*lexutil.BlobSchema, error) {
179
181
client := cs.APIClient()
180
182
181
181
-
req := atpclient.NewAPIRequest("POST", "com.atproto.repo.uploadBlob", file)
183
183
+
fileBytes, err := io.ReadAll(file)
184
184
+
if err != nil {
185
185
+
return nil, errors.New("failed to readall: " + err.Error())
186
186
+
}
187
187
+
fileReader := bytes.NewReader(fileBytes)
188
188
+
189
189
+
req := atpclient.NewAPIRequest("POST", "com.atproto.repo.uploadBlob", fileReader)
182
190
resp, err := client.Do(ctx, req)
183
191
if err != nil {
184
192
return nil, err