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
package oauth
2
3
import (
0
4
"context"
5
"encoding/json"
6
"errors"
7
"fmt"
0
8
9
"github.com/bluesky-social/indigo/api/atproto"
10
"github.com/bluesky-social/indigo/atproto/auth/oauth"
···
178
func UploadBLOB(cs *oauth.ClientSession, file multipart.File, ctx context.Context) (*lexutil.BlobSchema, error) {
179
client := cs.APIClient()
180
181
-
req := atpclient.NewAPIRequest("POST", "com.atproto.repo.uploadBlob", file)
0
0
0
0
0
0
182
resp, err := client.Do(ctx, req)
183
if err != nil {
184
return nil, err
···
1
package oauth
2
3
import (
4
+
"bytes"
5
"context"
6
"encoding/json"
7
"errors"
8
"fmt"
9
+
"io"
10
11
"github.com/bluesky-social/indigo/api/atproto"
12
"github.com/bluesky-social/indigo/atproto/auth/oauth"
···
180
func UploadBLOB(cs *oauth.ClientSession, file multipart.File, ctx context.Context) (*lexutil.BlobSchema, error) {
181
client := cs.APIClient()
182
183
+
fileBytes, err := io.ReadAll(file)
184
+
if err != nil {
185
+
return nil, errors.New("failed to readall: " + err.Error())
186
+
}
187
+
fileReader := bytes.NewReader(fileBytes)
188
+
189
+
req := atpclient.NewAPIRequest("POST", "com.atproto.repo.uploadBlob", fileReader)
190
resp, err := client.Do(ctx, req)
191
if err != nil {
192
return nil, err