Commit 3db71cd
committed
fix(sdk-core): convert blob upload results to proper JsonBlobRef format
When uploading images for collection avatars/banners, validation failed with:
'ValidationError: Invalid collection record: Record/banner/image should be a blob ref'
The issue: blobs.upload() returns { ref, mimeType, size } but AT Protocol
lexicons define SmallImage.image and LargeImage.image as BlobRef, which
requires the full structure including $type: 'blob'.
Two helper methods were passing raw upload results directly:
- resolveCollectionImageInput() for avatar/banner images
- resolveUriOrBlob() for location/attachment blobs
The SDK already had blobToJsonRef() to add the required $type: 'blob',
but these methods weren't using it. Other code paths (uploadImageBlob,
updateClaim) correctly used blobToJsonRef() and worked fine.
Without $type: 'blob', the server rejects the record because the blob
reference doesn't match the expected BlobRef schema from @atproto/lexicon.1 parent fd33ee5 commit 3db71cd
File tree
2 files changed
+30
-32
lines changed- packages/sdk-core
- src/repository
- tests/repository
2 files changed
+30
-32
lines changedLines changed: 4 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
959 | 959 | | |
960 | 960 | | |
961 | 961 | | |
962 | | - | |
| 962 | + | |
963 | 963 | | |
964 | 964 | | |
965 | 965 | | |
| |||
974 | 974 | | |
975 | 975 | | |
976 | 976 | | |
| 977 | + | |
977 | 978 | | |
978 | | - | |
| 979 | + | |
979 | 980 | | |
980 | 981 | | |
981 | | - | |
| 982 | + | |
982 | 983 | | |
983 | 984 | | |
984 | 985 | | |
| |||
Lines changed: 26 additions & 29 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
994 | 994 | | |
995 | 995 | | |
996 | 996 | | |
997 | | - | |
| 997 | + | |
| 998 | + | |
998 | 999 | | |
999 | 1000 | | |
1000 | 1001 | | |
| |||
1203 | 1204 | | |
1204 | 1205 | | |
1205 | 1206 | | |
1206 | | - | |
| 1207 | + | |
1207 | 1208 | | |
1208 | 1209 | | |
1209 | 1210 | | |
| |||
1266 | 1267 | | |
1267 | 1268 | | |
1268 | 1269 | | |
1269 | | - | |
| 1270 | + | |
1270 | 1271 | | |
1271 | 1272 | | |
1272 | 1273 | | |
| |||
2053 | 2054 | | |
2054 | 2055 | | |
2055 | 2056 | | |
2056 | | - | |
2057 | | - | |
2058 | | - | |
2059 | | - | |
2060 | | - | |
2061 | | - | |
2062 | | - | |
2063 | | - | |
2064 | | - | |
2065 | | - | |
2066 | | - | |
2067 | | - | |
2068 | | - | |
2069 | | - | |
2070 | | - | |
2071 | | - | |
2072 | | - | |
2073 | | - | |
2074 | | - | |
2075 | | - | |
2076 | | - | |
2077 | | - | |
2078 | | - | |
| 2057 | + | |
| 2058 | + | |
| 2059 | + | |
| 2060 | + | |
| 2061 | + | |
| 2062 | + | |
| 2063 | + | |
| 2064 | + | |
| 2065 | + | |
| 2066 | + | |
| 2067 | + | |
| 2068 | + | |
2079 | 2069 | | |
2080 | 2070 | | |
2081 | 2071 | | |
| |||
2091 | 2081 | | |
2092 | 2082 | | |
2093 | 2083 | | |
| 2084 | + | |
2094 | 2085 | | |
2095 | 2086 | | |
2096 | 2087 | | |
2097 | 2088 | | |
2098 | 2089 | | |
2099 | 2090 | | |
2100 | 2091 | | |
| 2092 | + | |
| 2093 | + | |
| 2094 | + | |
2101 | 2095 | | |
2102 | 2096 | | |
2103 | 2097 | | |
| 2098 | + | |
| 2099 | + | |
| 2100 | + | |
2104 | 2101 | | |
2105 | 2102 | | |
2106 | 2103 | | |
| |||
2683 | 2680 | | |
2684 | 2681 | | |
2685 | 2682 | | |
2686 | | - | |
| 2683 | + | |
2687 | 2684 | | |
2688 | 2685 | | |
2689 | 2686 | | |
| |||
2705 | 2702 | | |
2706 | 2703 | | |
2707 | 2704 | | |
2708 | | - | |
| 2705 | + | |
2709 | 2706 | | |
2710 | 2707 | | |
2711 | 2708 | | |
| |||
3220 | 3217 | | |
3221 | 3218 | | |
3222 | 3219 | | |
3223 | | - | |
| 3220 | + | |
3224 | 3221 | | |
3225 | 3222 | | |
3226 | 3223 | | |
| |||
0 commit comments