Skip to content
This repository was archived by the owner on Aug 10, 2024. It is now read-only.

Commit eec4693

Browse files
committed
FIX: handling search results
1 parent 74c459b commit eec4693

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

cloudflare-worker/worker.js

+8-6
Original file line numberDiff line numberDiff line change
@@ -208,12 +208,14 @@ async function getFeedSkeleton(request, env) {
208208

209209
let timestampURLs = [];
210210
for (let item of allItems) {
211-
if (item.type === "search") {
212-
let did = item.user.did;
213-
let rkey = item.tid.split("/").slice(-1)[0];
214-
let timestamp = item.post.createdAt;
215-
let atURL = `at://${did}/app.bsky.feed.post/${rkey}`;
216-
timestampURLs.push([timestamp, atURL]);
211+
if (item.type === "search" && Array.isArray(item.json)) {
212+
for (let searchResult of item.json) {
213+
let did = searchResult.user.did;
214+
let rkey = searchResult.tid.split("/").slice(-1)[0];
215+
let timestamp = searchResult.post.createdAt;
216+
let atURL = `at://${did}/app.bsky.feed.post/${rkey}`;
217+
timestampURLs.push([timestamp, atURL]);
218+
}
217219
} else if (item.type === "user") {
218220
if (item.json.feed !== undefined) {
219221
for (let feedItem of item.json.feed) {

0 commit comments

Comments
 (0)